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3RVGNFAIR6QAGEGNHBMTAC
KFDHXOBPUELMMRCYK6VQ4426M567KN5X2ACL5STM47AD7BMFHDVAC
LEY3QGCOMNZLJFZ5JQBSAUAZIJ7JRTMRFQADOG3EUPLNDZZB2YZQC
DP7ZONE3EV2FDYPE7ZJUUCRP27GDJZJMXAO6YNSQEEP7GEVX7R6QC
4D7TFJR4CXMDTY4SQ22YL3GEKSSAOI7VYRZ3LZDNE5TCWQJEPLQQC
AT4I3XSN3KN4K56GP5ZV55NKYDZ7LFV4AHKMB3PHQCXN56SADVTAC
FA2FZW73JE5ZLOUGZWFGHH42W4LOYMQPTHMIV5DJBDEFNGNTYOCQC
O4DFDXEXZ7ONXUAKX4AKXXL5HXGWOG3T6N7R4JRICGF2OTQISIXQC
A37TL3BFJT3IZTFXX3FMXO4XFASBSF5YLK5EEX76YB3ZTPZGK44QC
PN2RWYDVAV4LCV7NXBRAFNODHOQKJFGOYNTTXL3336JBOWNLR2OAC
K5PQ626TQQRIYJPYDZ5OM77ZIBX2G2QXALFRJCSKVF3PKO37C7KAC
SC7MDSHCX3734KSWU4YFGJTKLJRSRM7AHC4MALZKQGDAHH42ILJQC
YGDTHEQOWHU2QL7CGXAH7QS2AOTV75L7HQOZWMSUYNP4XG5PKARQC
KEUZRLNHDBXK4JIUTND56MEYHZAY4RAGMHIK5G2DTAPOKQDIGGSAC
S5T54QCKBJYU6WEIJ4YIROHVFD7JGQH5LNB33MKPCLXKN3JJ2SRQC
JVR62HUUI6MKIJ2KIAYRKVPBSQCRGPKB2PVMCIX7CA6IEI6HDUUAC
4CY7MCSHC3SH56WYDFAIATDJWXLODX3MBTSEPRIYJAAHRVL5TUOAC
you have to symlink the layer into ~/.emacs.d/private/
then add the name of the layer into `~/.spacemacs` in `dotspacemacs-configuration-layers`
like this:
```
dotspacemacs-configuration-layers
'(
personal-layer
... a bunch of stuff already here and comments
)
```
NOTE: we do not sync the .spacemacs file with vcs cause it's a pain in the ass and stores a lot of state.
Just init emacs for the first time, choose the basic normal settings, add the layer then restart emacs.
# -*- mode: snippet -*-
# name: new react component
# key: new react comonent
# --
import React from "react";
import PropTypes from "prop-types";
const ${1:ComponentName} = props => {
return (
<div>hello</div>
);
}
$1.defaultProps = {};
$1.propTypes = {};
# -*- mode: snippet -*-
# name: react new component test
# key: react new component test
# --
import PropTypes from "prop-types";
import { runAllComponentSmokeTests } from "../componentTestHelpers.js";
import ${1} from "./${2}.js";
const requiredProps = {$0};
runAllComponentSmokeTests($1, requiredProps);
;; Use this as a template for new dir locals
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
(fill-column . 120)
(python-auto-set-local-pyenv-version . 'on-project-switch)
;; toggle for running black on save if non nil
(personal-layer-use-black-formater . t)
(blacken-executable . "full path to black")
(flycheck-python-mypy-executable . "full path to mypy")
;; useful for very django-y projects, or projects with local dependencies
(python-shell-process-environment. "DJANGO_SETTINGS_MODULE=full path to settings module")
(eval . (progn
(add-to-list 'python-shell-extra-pythonpaths "full path to extra dependencies (or django apps)")
(add-to-list 'python-shell-extra-pythonpaths "more full path to extra dependencies (or django apps)")))
))
;; these are useful when the project is python 2 virtualenv
;; python project examples
(python-mode
(
(defvar personal-layer-use-black-formater nil "Toggle for running black on saving a buffer.")
;; default emacs overrides
(setq tramp-default-method "ssh")
;; default spacemacs overrides
(setq-default dotspacemacs-themes '(spacemacs-light spacemacs-dark leuven))
(setq
dotspacemacs-helm-resize t
dotspacemacs-maximized-at-startup t
dotspacemacs-whitespace-cleanup 'trailing
dotspacemacs-maximized-at-startup t
dotspacemacs-fullscreen-at-startup nil)
dotspacemacs-search-tools '("rg" "grep")
(funcall (cdr pattern-and-minor-mode)))))
(let ((word-pattern "-_A-Za-z0-9")
(start-pnt nil)
(end-pnt nil))
(skip-chars-forward word-pattern)
(setq end-pnt (point))
(skip-chars-backward word-pattern)
(setq start-pnt (point))
(cons start-pnt end-pnt)))
(interactive)
(defun personal-layer/to-public-event-id ()
"Multiply the number by 1003."
(interactive)
(progn
(personal-layer/multiply-at-pt 1003)
(personal-layer/remove-leading "0")))
(defun personal-layer/to-private-event-id ()
"Divide the number by 1003."
(interactive)
(progn
(personal-layer/multiply-at-pt (/ 1.0 1003))
(personal-layer/remove-leading "0")))
(defun personal-layer/to-public-user-id ()
"Multiply the number by 1007."
(interactive)
(personal-layer/multiply-at-pt 1007))
(defun personal-layer/to-private-user-id ()
"Divide the number by 1007."
(interactive)
(progn
(personal-layer/multiply-at-pt (/ 1.0 1007))
(personal-layer/remove-leading "0"))))
(defun personal-layer/multiply-at-pt (&optional amount)
"Multiply the number currently under the cursor by amount."
(interactive)
(evil-numbers/inc-at-pt
(*
(string-to-number (current-word))
(-
(if amount amount (read-number "number to mulitiply by: "))
1))))
(when (configuration-layer/package-usedp 'evil-numbers)
;; These functions depend on evil-numbers
(let ((start-point (car (personal-layer/start-end-points-current-word)))
(char (if char char (read-string "character to remove: ")))
(end-point nil))
(goto-char start-point)
(skip-chars-forward char)
(setq end-point (point))
(delete-region start-point end-point)))
(defun personal-layer/remove-leading (&optional char)
"Remove the leading char from the current-word."
(defun personal-layer/start-end-points-current-word ()
"Return start and end points of the current-word."
(defun personal-layer-maybe-format-buffer-with-black ()
"If \"personal-layer-use-black-formater\" is non nil, call \"blacken-buffer\"."
(when (or personal-layer-use-black-formater)
(blacken-buffer)))
(defun personal-layer/toggle-python-breakpoint ()
"Add a breakpoint for python"
(interactive)
(progn
(back-to-indentation)
(insert "import ipdb; ipdb.set_trace(context=20)\n")
(python-indent-line)))
(defun personal-layer/enable-minor-mode (pattern-and-minor-mode)
"Enable minor mode if filename match the regexp. (regexp . minor-mode)."
(when (buffer-file-name)
(when (string-match (car pattern-and-minor-mode) buffer-file-name)
(configuration-layer/declare-layers
'(
ansible
better-defaults
common-lisp
csv
emacs-lisp
emoji
git
gtags
helm
html
javascript
markdown
mu4e
org
php
react
rust
shell
shell-scripts
spell-checking
sql
syntax-checking
version-control
vimscript
yaml
(auto-completion :variables
auto-completion-enable-sort-by-usage t
auto-completion-enable-snippets-in-popup t)))
(ruby :variables
ruby-version-manager 'rbenv)
ruby-on-rails
(python :variables
python-backend 'lsp
python-lsp-server 'pyls
python-formatter 'black
python-sort-imports-on-save t)
(lsp :variables
lsp-rust-server 'rust-analyzer)
;;; packages.el --- personal-layer layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Chris Cummings <chris@thesogu.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Commentary:
;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so
;; define the functions `personal-layer/pre-init-PACKAGE' and/or
;; `personal-layer/post-init-PACKAGE' to customize the package as it is loaded.
;;; Code:
(defconst personal-layer-packages
'(
docker-tramp
git-commit
git-gutter+
python
seq
smtpmail-multi
web-mode
))
(defun personal-layer/init-smtpmail-multi ()
(defun personal-layer/post-init-git-commit ()
"Configure git-commit."
(global-git-commit-mode t))
(defun personal-layer/post-init-git-gutter+ ()
"Configure get-gutter+."
;; https://github.com/nonsequitur/git-gutter-plus/pull/39
(defun git-gutter+-remote-default-directory (dir file)
(let* ((vec (tramp-dissect-file-name file))
(method (tramp-file-name-method vec))
(user (tramp-file-name-user vec))
(domain (tramp-file-name-domain vec))
(host (tramp-file-name-host vec))
(port (tramp-file-name-port vec)))
(tramp-make-tramp-file-name method user domain host port dir)))
(defun git-gutter+-remote-file-path (dir file)
(let ((file (tramp-file-name-localname (tramp-dissect-file-name file))))
(replace-regexp-in-string (concat "\\`" dir) "" file))))
;; use rg instead of ag, ag must still be installed
(defun personal-layer/post-init-web-mode ()
"Enable prettier-js-mode if using .js or .jsx buffer."
(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
(add-hook
'web-mode-hook
;;; packages.el ends here
(defun personal-layer/post-init-yassnippet-snippets ()
"Configure yasnippet-snippets."
(append yas-snippet-dirs yassnippet-snippets-dir))
#'(lambda () (personal-layer/enable-minor-mode '("\\.js\\'" . prettier-js-mode)))))
;; (defun personal-layer/post-init-yasnippet ()
;; "Configure yasnippet."
;; ;; add snippet dirs not in VCS to yas-snippet-dirs
;; (progn
;; (setq
;; yas-snippet-dirs
;; (append yas-snippet-dirs
;; (seq-filter
;; 'file-directory-p
;; '("~/Google Drive File Stream/My Drive/config_backups/snippets"
;; "~/Library/Mobile Documents/com~apple~CloudDocs/config_backups/snippets"))))
;; ;; TODO: could this be moved somewhere earlier in the init process
;; ;; so that we don't have to call `yas-reload-all`?
;; (yas-reload-all)))
;; (setq helm-ag-base-command "rg --no-heading")
;; )
;; NOTE: not needed for develop branch
;; (defun personal-layer/post-init-helm-ag ()
;; "Configure helm-ag package."
"Own smtpmail-multi package."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; post inits for configuration of any packages
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun personal-layer/post-init-anaconda-mode ()
"Configure anaconda-mode."
(setq anaconda-mode-localhost-address "localhost"))
(defun personal-layer/post-init-blacken ()
"Configure blacken."
(define-minor-mode blacken-mode
"Optionally run black before saving."
:lighter " Black"
(if blacken-mode
(add-hook 'before-save-hook 'personal-layer-maybe-format-buffer-with-black nil t)
(remove-hook 'before-save-hook 'personal-layer-maybe-format-buffer-with-black t))))
(defun personal-layer/post-init-python ()
"Configure python."
(progn
(spacemacs|use-package-add-hook python
:post-config
(spacemacs/set-leader-keys-for-major-mode 'python-mode
"dB" 'personal-layer/toggle-python-breakpoint))))
(use-package smtpmail-multi :defer t))
(defun personal-layer/init-docker-tramp ()
(defun personal-layer/init-seq ()
"Own seq package."
(use-package seq :defer t))
"Own docker-tramp package."
(use-package docker-tramp :defer t))
;;;;;;;;;;;;;;;;;;;;;;;;
;; inits for ownership
;;;;;;;;;;;;;;;;;;;;;;;;
(blacken :location (recipe
:fetcher github
:repo "proofit404/blacken"))
anaconda-mode
(spacemacs/declare-prefix "o" "personal-layer")
(when (configuration-layer/package-usedp 'evil-numbers)
(spacemacs/set-leader-keys
"op" 'personal-layer/to-private-event-id
"oP" 'personal-layer/to-public-event-id
"ou" 'personal-layer/to-private-user-id
"oU" 'personal-layer/to-public-user-id))
"o*" 'personal-layer/multiply-at-pt