diff options
Diffstat (limited to 'configs/shared')
-rw-r--r-- | configs/shared/.ctags | 104 | ||||
-rw-r--r-- | configs/shared/.emacs | 614 | ||||
-rw-r--r-- | configs/shared/.tmux.conf | 217 | ||||
-rw-r--r-- | configs/shared/.vimrc | 544 | ||||
-rw-r--r-- | configs/shared/.zsh_profile | 97 |
5 files changed, 1576 insertions, 0 deletions
diff --git a/configs/shared/.ctags b/configs/shared/.ctags new file mode 100644 index 000000000000..c018567f2041 --- /dev/null +++ b/configs/shared/.ctags @@ -0,0 +1,104 @@ +--recurse=yes +--exclude=.git +--exclude=vendor/ +--exclude=node_modules +--exclude=db +--exclude=log +--exclude=tmp + + +--langdef=Elixir +--langmap=Elixir:.ex.exs +--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/ +--regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/ +--regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/ +--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/ +--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/ +--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/ +--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/ +--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/ +--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/ +--regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/ +--regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/ + + +--regex-ruby=/.*alias(_method)?[[:space:]]+:([[:alnum:]_=!?]+),?[[:space:]]+:([[:alnum:]_=!]+)/\2/f,function/ +--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/ +--regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function,association/ +--regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function,named_scope/ +--regex-ruby=/(^|;)[ \t]*expose\(? *:([[:alnum:]_]+)/\2/f,function,exposure/ +--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function,aasm_event/ +--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/ +--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/ + +--langmap=Ruby:+(Rakefile) + +--langdef=js +--langmap=js:.js +--langmap=js:+.jsx + +--regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/ + +--regex-js=/\.([A-Za-z0-9._$]+)[ \t]*=[ \t]*\{/\1/o,object/ +--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*[ \t]*:[ \t]*\{/\1/o,object/ +--regex-js=/([A-Za-z0-9._$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*\{/\1\.\2/o,object/ + +--regex-js=/([A-Za-z0-9._$]+)[ \t]*=[ \t]*\(function\(\)/\1/c,class/ +--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*:[ \t]*\(function\(\)/\1/c,class/ +--regex-js=/class[ \t]+([A-Za-z0-9._$]+)[ \t]*/\1/c,class/ +--regex-js=/([A-Za-z$][A-Za-z0-9_$()]+)[ \t]*=[ \t]*[Rr]eact.createClass[ \t]*\(/\1/c,class/ +--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*=[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/ +--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*:[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/ + +--regex-js=/([A-Za-z$][A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\1/f,function/ + +--regex-js=/(function)*[ \t]*([A-Za-z$_][A-Za-z0-9_$]+)[ \t]*\([^)]*\)[ \t]*\{/\2/f,function/ +--regex-js=/['"]*([A-Za-z$][A-Za-z0-9_$]+)['"]*:[ \t]*function[ \t]*\(/\1/m,method/ +--regex-js=/([A-Za-z0-9_$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*function[ \t]*\(/\2/m,method/ + + +--langdef=haskell +--langmap=haskell:.hs +--regex-haskell=/^module[ \t]*([A-Z][a-zA-Z0-9'_.]*)/\1/m,module/ +--regex-haskell=/^(new)?type[ \t]*([A-Z][a-zA-Z0-9'_]*)./\2/t,type/ +--regex-haskell=/^class[ \t]*([A-Z][a-zA-Z0-9'_]*)/\1/c,class/ +--regex-haskell=/^data[ \t]*([A-Z][a-zA-Z0-9'_]*)/\1/d,data/ +--regex-haskell=/^([a-z_][a-zA-Z0-9'_]*).*=/\1/v,function/ + +--langmap=C++:+.mm + +--langdef=golang +--langmap=golang:.go +--regex-golang=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/ +--regex-golang=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/ +--regex-golang=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/ + +--langdef=Rust +--langmap=Rust:.rs +--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\6/f,functions,function definitions/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/ +--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\4 \6 \7/i,impls,trait implementations/ +--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/ + +--langdef=typescript +--langmap=typescript:.ts +--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/ +--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/ +--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/ +--regex-typescript=/^[ \t]*export[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\1/v,variables/ +--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/ +--regex-typescript=/^[ \t]*(export)?[ \t]*(public|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/ +--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/ +--regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/ +--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_]+)/\1/I,imports/ + +--langdef=elm +--langmap=elm:.elm +--regex-elm=/^module[ \t]*([A-Z][a-zA-Z0-9'_.]*)/\1/m,module/ +--regex-elm=/^type[ \t]*([A-Z][a-zA-Z0-9'_]*)./\1/t,type/ +--regex-elm=/^([a-z_][a-zA-Z0-9'_]*).*=/\1/v,function/ diff --git a/configs/shared/.emacs b/configs/shared/.emacs new file mode 100644 index 000000000000..8c66c3c1592c --- /dev/null +++ b/configs/shared/.emacs @@ -0,0 +1,614 @@ +;;; William Carroll's Emacs configuration + + +;; From `https://github.com/melpa/melpa` +(require 'package) +(add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/") t) +(when (< emacs-major-version 24) + ;; For important compatibility libraries like cl-lib + (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))) +(package-initialize) + + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(ansi-color-faces-vector + [default bold shadow italic underline bold bold-italic bold]) + '(ansi-color-names-vector + (vector "#eaeaea" "#d54e53" "#b9ca4a" "#e7c547" "#7aa6da" "#c397d8" "#70c0b1" "#424242")) + '(column-number-mode t) + '(custom-enabled-themes (quote (sanityinc-tomorrow-eighties))) + '(custom-safe-themes + (quote + ("5c9bd73de767fa0d0ea71ee2f3ca6fe77261d931c3d4f7cca0734e2a3282f439" "628278136f88aa1a151bb2d6c8a86bf2b7631fbea5f0f76cba2a0079cd910f7d" "1b8d67b43ff1723960eb5e0cba512a2c7a2ad544ddb2533a90101fd1852b426e" "82d2cac368ccdec2fcc7573f24c3f79654b78bf133096f9b40c20d97ec1d8016" "06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" "bb08c73af94ee74453c90422485b29e5643b73b05e8de029a6909af6a3fb3f58" "398e6465d45d5af4cbf94f8ebfb24deb71249f28cdfb4b0fa7197354ee0c9802" "db34c17b9a7810856352a341e15d701696fb4710fe7e0dab57b8268515c2b082" "ee93cac221c92b580bde1326209e1a327287cd49931ba319a9af7a7af201967c" "68f66d916f4e90f11f2dc815e9580c1aaf9e9c75eeee3fbd8b663d706e121a1a" "c158c2a9f1c5fcf27598d313eec9f9dceadf131ccd10abc6448004b14984767c" "cc0dbb53a10215b696d391a90de635ba1699072745bf653b53774706999208e3" "3e335d794ed3030fefd0dbd7ff2d3555e29481fe4bbb0106ea11c660d6001767" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "20e23cba00cf376ea6f20049022241c02a315547fc86df007544852c94ab44cb" "60d4556ebff0dc94849f177b85dcb6956fe9bd394c18a37e339c0fcd7c83e4a9" "707227acad0cf8d4db55dcf1e574b3644b68eab8aca4a8ce6635c8830bc72144" "1c656eb3f6ae6c84ced46282cb4ed697bffe2f6c764bb5a737ed7ca6d068f798" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" "c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "9f3181dc1fabe5d58bbbda8c48ef7ece59b01bed606cfb868dd147e8b36af97c" "ad1c2abad40e11d22156fe3987fd9b74b9e1c822264a07dacb24e0b3133aaed1" "945fe66fbc30a7cbe0ed3e970195a7ee79ee34f49a86bc96d02662ab449b8134" "0f0db69b7a75a7466ef2c093e127a3fe3213ce79b87c95d39ed1eccd6fe69f74" "08b8807d23c290c840bbb14614a83878529359eaba1805618b3be7d61b0b0a32" "9d91458c4ad7c74cf946bd97ad085c0f6a40c370ac0a1cbeb2e3879f15b40553" "6254372d3ffe543979f21c4a4179cd819b808e5dd0f1787e2a2a647f5759c1d1" "8ec2e01474ad56ee33bc0534bdbe7842eea74dccfb576e09f99ef89a705f5501" "5b24babd20e58465e070a8d7850ec573fe30aca66c8383a62a5e7a3588db830b" "eb0a314ac9f75a2bf6ed53563b5d28b563eeba938f8433f6d1db781a47da1366" "3d47d88c86c30150c9a993cc14c808c769dad2d4e9d0388a24fee1fbf61f0971" default))) + '(evil-shift-width 2) + '(fci-rule-color "#424242") + '(mouse-wheel-mode nil) + '(neo-window-fixed-size nil) + '(neo-window-width 35) + '(package-selected-packages + (quote + (dired+ linum-off git markdown-mode yaml-mode haskell-mode color-theme-sanityinc-tomorrow graphql-mode flycheck-elm popup-kill-ring green-phosphor-theme green-screen-theme minimal-theme creamsody-theme autothemer solarized-theme avk-emacs-themes github-theme all-the-icons-dired ace-window yasnippet chess synonyms powerline doom-neotree doom-themes persp-mode use-package helm-projectile persp-projectile perspective projectile with-editor helm-core company helm-ag evil-leader flycheck-mix flycheck-elixir evil-matchit typescript-mode evil-surround erlang elixir-mode golden-ratio flycheck-credo flycheck command-log-mode atom-one-dark-theme exec-path-from-shell clues-theme gotham-theme dracula-theme zenburn-theme fill-column-indicator neotree evil iedit vimrc-mode helm-ispell transpose-frame helm-ack nyan-mode alchemist helm dockerfile-mode elm-mode ack))) + '(popwin-mode t) + '(popwin:popup-window-height 25) + '(popwin:special-display-config + (quote + (help-mode + ("^*helm-.+*$" :regexp t) + ("^*helm .+*$" :regexp t) + ("^*helm-.+*$" :regexp t) + ("^*helm .+*$" :regexp t) + ("^*helm .+*$" :regexp t) + ("*Miniedit Help*" :noselect t) + (completion-list-mode :noselect t) + (compilation-mode :noselect t) + (grep-mode :noselect t) + (occur-mode :noselect t) + ("*Pp Macroexpand Output*" :noselect t) + "*Shell Command Output*" "*vc-diff*" "*vc-change-log*" + (" *undo-tree*" :width 60 :position right) + ("^\\*anything.*\\*$" :regexp t) + "*slime-apropos*" "*slime-macroexpansion*" "*slime-description*" + ("*slime-compilation*" :noselect t) + "*slime-xref*" + (sldb-mode :stick t) + slime-repl-mode slime-connection-list-mode))) + '(tool-bar-mode nil) + '(vc-annotate-background nil) + '(vc-annotate-color-map + (quote + ((20 . "#d54e53") + (40 . "#e78c45") + (60 . "#e7c547") + (80 . "#b9ca4a") + (100 . "#70c0b1") + (120 . "#7aa6da") + (140 . "#c397d8") + (160 . "#d54e53") + (180 . "#e78c45") + (200 . "#e7c547") + (220 . "#b9ca4a") + (240 . "#70c0b1") + (260 . "#7aa6da") + (280 . "#c397d8") + (300 . "#d54e53") + (320 . "#e78c45") + (340 . "#e7c547") + (360 . "#b9ca4a")))) + '(vc-annotate-very-old-color nil)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(hl-line ((t (:inherit nil))))) + + +;; Avoid re-read from disk prompt after switching git branches +(global-auto-revert-mode t) + + +;; server stuff +(server-start) + + +;; File extensions and their associated major modes +(add-to-list 'auto-mode-alist '("\\.zsh_profile\\'" . shell-script-mode)) + + +;; Turn off line-wrapping (default) +(set-default 'truncate-lines t) +(setq truncate-partial-width-windows nil) + +(setq css-indent-offset 2) +(setq js-indent-level 2) + +;; Window Auto-Balancing +(defadvice split-window-below (after restore-balanace-below activate) + (balance-windows)) + +(defadvice split-window-right (after restore-balance-right activate) + (balance-windows)) + +(defadvice delete-window (after restore-balance activate) + (balance-windows)) + + +;; Extend load-path +(add-to-list 'load-path "~/.emacs.d/wc-downloads") + + +;; Smart Mode Line +(use-package smart-mode-line + :ensure t + :config + (load-theme 'smart-mode-line-dark) + (smart-mode-line-enable)) + + +;; Nyan cat +(use-package nyan-mode + :ensure t) + + +;; Git client +(use-package git + :ensure t) + + +;; Load custom Emacs functions +(load "~/.emacs.d/wc-helper-functions.el") + + +;; ERC configuration (IRC in Emacs) +(use-package erc + :ensure t + :init + (setq erc-autojoin-channels-alist '(("freenode.net" "#emacs" "#elixir")))) + + +;; Disable fringes in Emacs +(fringe-mode 0) + + +;; Linum +(use-package linum + :init + (setq linum-disabled-modes-list '(term-mode dired-mode Man-mode org-mode emacs-pager-mode)) + :config + (defun linum-on () + (if (or (memq major-mode linum-disabled-modes-list) + (minibufferp) + (string-match-p "*" (buffer-name))) + (linum-mode -1) + (progn + (linum-mode nil) + (evil-local-mode)))) + (setq linum-format " %d ") + (global-linum-mode t)) + + +;; Command Log Mode +(use-package command-log-mode + :ensure t + :config + (setq-default command-log-mode-window-font-size 1) + (setq-default command-log-mode-window-size 40)) + + +;; Ace Window +(use-package ace-window + :ensure t + :config + (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))) + + +;; All-the-fonts +(use-package all-the-icons + :ensure t) + + +;; Thesaurus +(use-package synonyms + :ensure t) + + +;; Doom Themes +(use-package doom-themes + :ensure t + :init + (use-package doom-nlinum)) + + +;; View stream of Emacs commands +(use-package command-log-mode + :ensure t + :commands (global-command-log-mode)) + + +;; Flycheck Settings +(use-package flycheck + :ensure t + :config + (setq flycheck-display-errors-delay 0.0)) + + +(defadvice term-sentinel (around my-advice-term-sentinel (proc msg)) + (if (memq (process-status proc) '(signal exit)) + (let ((buffer (process-buffer proc))) + ad-do-it + (kill-buffer-and-window)) + ad-do-it)) +(ad-activate 'term-sentinel) + + +;; Ansi-Term +(use-package term + :ensure t + :init + (setq explicit-shell-file-name "/bin/zsh") + :config + (add-hook 'term-mode-hook 'wc/bootstrap-ansi-term)) + + +;; Projectile Settings +(use-package projectile + :ensure t + :commands (projectile-mode)) + + +;; Dired Settings +(use-package dired + :init + (load "~/.emacs.d/wc-dired-functions.el") + :bind (:map dired-mode-map + ("C-p" . helm-ag-neotree-node) + ("e" . wdired-change-to-wdired-mode) + ("c" . find-file) + ("RET" . dired-find-alternate-file) + ("^" . wc/dired-up-directory)) + :config + (setq wdired-allow-to-change-permissions t)) + + +;; Dired-plus +(use-package dired+ + :ensure t + :init + (setq diredp-hide-details-initially-flag nil) + :config + ;; remove bindings that interfere with globally-set windmove bindings + (define-key dired-mode-map (kbd "C-h") nil) + (define-key dired-mode-map (kbd "C-j") nil) + (define-key dired-mode-map (kbd "C-k") nil) + (define-key dired-mode-map (kbd "C-l") nil)) + + +;; Evil Settings +(use-package evil + :ensure t + :commands (evil-mode local-evil-mode) + :bind (:map evil-visual-state-map + ("H" . evil-first-non-blank) + ("L" . evil-end-of-visual-line) + + :map evil-motion-state-map + ("<return>" . nil) + ([tab] . nil) + ("SPC" . nil) + ("M-." . nil) + + :map evil-insert-state-map + ("C-k" . nil) + ("C-p" . nil) + ("C-n" . nil) + ("C-r" . nil) + ("C-t" . nil) + ("C-e" . nil) + ("C-a" . nil) + ("C-h" . evil-window-left) + ("C-l" . evil-window-right) + ("C-k" . evil-window-up) + ("C-j" . evil-window-down) + ("C-c" . term-interrupt-subjob) + + :map evil-normal-state-map + ("<return>" . nil) + ([tab] . nil) + ("K" . nil) + ("M-." . nil) + ("s" . nil) + ("C-p" . nil) + ("C-h" . evil-window-left) + ("C-l" . evil-window-right) + ("C-k" . evil-window-up) + ("C-j" . evil-window-down) + ("g c" . comment-or-uncomment-region) + ("s h" . evil-window-vsplit) + ("s l" . evil-window-vsplit-right) + ("s k" . evil-window-split) + ("s j" . evil-window-split-down) + ("H" . evil-first-non-blank) + ("L" . evil-end-of-line) + ("<S-left>" . evil-window-increase-width) + ("<S-right>" . evil-window-decrease-width) + ("<S-up>" . evil-window-decrease-height) + ("<S-down>" . evil-window-increase-height) + + :map evil-ex-map + ("tb" . alchemist-test-this-buffer) + ("tap" . alchemist-test-at-point) + ("lt" . alchemist-mix-rerun-last-test)) + :init + (global-evil-matchit-mode t) + (global-evil-surround-mode t) + (global-evil-leader-mode t) + :config + (setq evil-emacs-state-cursor '("VioletRed3" box)) + (setq evil-normal-state-cursor '("DeepSkyBlue2" box)) + (setq evil-visual-state-cursor '("orange" box)) + (setq evil-insert-state-cursor '("VioletRed3" bar)) + (setq evil-replace-state-cursor '("VioletRed3" bar)) + (setq evil-operator-state-cursor '("VioletRed3" hollow)) + (evil-ex-define-cmd (kbd "w") 'save-buffer-always) + + ;; center search results + (defadvice evil-search-next + (after center-evil-search-next activate) + (call-interactively 'evil-scroll-line-to-center)) + + (defadvice evil-search-previous + (after center-evil-search-previous activate) + (call-interactively 'evil-scroll-line-to-center)) + + (add-hook 'org-mode-hook 'evil-local-mode)) + + +;; Hack at the moment for extending the behavior of the jump to mark command +(evil-define-command evil-goto-mark-line (char) + "Go to line of marker denoted by CHAR." + :keep-visual t + :repeat nil + :type line + (interactive (list (read-char))) + (evil-goto-mark char) + (evil-first-non-blank) + (call-interactively 'evil-scroll-line-to-center)) + + +(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") + + +;; Evil Leader Settings +(use-package evil-leader + :ensure t + :commands (global-evil-leader-mode) + :config + (evil-leader/set-leader "<SPC>") + (evil-leader/set-key + "[" 'flycheck-previous-error + "]" 'flycheck-next-error + "w" 'toggle-truncate-lines + "x" 'helm-M-x + "<SPC>" 'wc/switch-to-mru-buffer + "a" 'ace-delete-window + "s" 'ace-swap-window + "n" 'neotree-toggle-project-dir + "N" 'neotree-reveal-current-buffer + "t" 'alchemist-project-toggle-file-and-tests + "f" 'helm-projectile + "p" 'helm-projectile-ag + "d" 'dired-jump + "D" 'projectile-dired + "q" 'kill-this-buffer + "h" 'help + "i" 'helm-semantic-or-imenu + "b" 'helm-mini + "T" 'alchemist-mix-test-at-point + "B" 'alchemist-mix-test-this-buffer + "L" 'alchemist-mix-rerun-last-test + "z" 'wc/projectile-shell-pop)) + + +;; Evil Match-it +(use-package evil-matchit + :ensure t + :commands (global-evil-matchit-mode)) + + +;; Evil Surround +(use-package evil-surround + :ensure t + :commands (global-evil-surround-mode)) + + +;; Flycheck Mix Settings +(use-package flycheck-mix + :ensure t + :init + (flycheck-mix-setup)) + + +;; Flycheck +(use-package flycheck + :ensure t + :config) + ;; (setq flycheck-display-errors-function 'ignore)) + + +;; Flycheck Credo Settings +(use-package flycheck-credo + :ensure t + :init + (flycheck-credo-setup)) + + +;; Popwin Settings +(use-package popwin + :ensure t) + + +(add-hook 'helm-minibuffer-set-up-hook #'*-popwin-help-mode-off) +(add-hook 'helm-cleanup-hook #'*-popwin-help-mode-on) + +(setq display-buffer-function 'popwin:display-buffer) +(setq helm-split-window-preferred-function 'ignore) +(push '("^\*helm .+\*$" :regexp t) popwin:special-display-config) +(push '("^\*helm-.+\*$" :regexp t) popwin:special-display-config) + + +;; Alchemist Settings +(use-package alchemist + :ensure t + :config + (setq alchemist-mix-env "prod") + (setq alchemist-goto-elixir-source-dir "~/source_code/elixir/") + (setq alchemist-goto-erlang-source-dir "~/source_code/otp/")) + + +(add-hook 'erlang-mode-hook 'wc/custom-erlang-mode-hook) + + +;; NeoTree Settings +(use-package neotree + :ensure t + :bind (:map neotree-mode-map + ("j" . next-line) + ("k" . previous-line) + ("<return>" . neotree-enter) + ([tab] . neotree-enter) + ("D" . neotree-delete-node) + ("R" . neotree-rename-node) + ("c" . neotree-create-node) + ("C-p" . helm-ag-neotree-node)) + :init + (hl-line-mode) + (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) + (setq-default neo-show-hidden-files t)) + + +;; Whitespace Settings +(use-package whitespace + :ensure t + :commands (whitespace-mode) + :config + (setq whitespace-line-column 100) + (setq whitespace-style '(face lines-tail))) + + +;; Helm Settings +(use-package helm + :ensure t + :commands (helm-mode) + :bind (("M-x" . helm-M-x) + ("M-y" . helm-show-kill-ring) + ("C-x b" . helm-mini) + ("C-x f" . helm-projectile-switch-project) + ("C-x p" . helm-projectile-ag) + ("C-x C-f" . helm-find-files) + + :map helm-map + ([backtab] . helm-previous-source) + ([tab] . helm-next-source) + ("C-j" . helm-next-line) + ("C-k" . helm-previous-line) + ("C-z" . helm-select-action) + + :term-raw-map + ("M-x" . helm-M-x)) + :init + (setq helm-buffers-fuzzy-matching t) + (setq helm-recentf-fuzzy-match t) + (setq helm-semantic-fuzzy-match t) + (setq helm-imenu-fuzzy-match t) + (setq helm-locate-fuzzy-match t) + :config + (load "~/.emacs.d/wc-helm-functions.el")) + + +;; Helm Projectile Settings +(use-package helm-projectile + :ensure t) + + +;; Elm Mode +(use-package elm-mode + :config + (add-to-list 'company-backends 'company-elm)) + + +;; Company Settings +(use-package company + :bind ( + ("C-j" . company-select-next) + ("C-k" . company-select-previous)) + :config + (setq company-idle-delay 0)) + + +(add-hook 'after-init-hook 'global-whitespace-mode) +(add-hook 'after-init-hook 'global-hl-line-mode) +(add-hook 'after-init-hook 'global-flycheck-mode) +(add-hook 'after-init-hook 'global-company-mode) +(add-hook 'after-init-hook 'projectile-mode) +(add-hook 'after-init-hook 'helm-mode) +(add-hook 'before-save-hook 'delete-trailing-whitespace) + + +;; Scrolling Settings +(setq scroll-step 1) +(setq scroll-conservatively 10000) + + +;; Properly configure GUI Emacs to use $PATH values +(when (memq window-system '(mac ns)) + (exec-path-from-shell-initialize)) + + +;; Emacs autosave, backup, interlocking files +(setq auto-save-default nil) +(setq make-backup-files nil) +(setq create-lockfiles nil) + + +;; Automatically follow symlinks +(setq vc-follow-symlinks t) + + +;; Commenting / Uncommenting +(global-set-key (kbd "C-x C-;") 'comment-or-uncomment-region) + + +;; Window movements +(global-set-key (kbd "C-h") 'windmove-left) +(global-set-key (kbd "C-l") 'windmove-right) +(global-set-key (kbd "C-k") 'windmove-up) +(global-set-key (kbd "C-j") 'windmove-down) + + +;; Fullscreen settings +(setq ns-use-native-fullscreen nil) +(global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen) + + +;; General Settings +;; Hide the menu-bar +(if (string-equal system-type "gnu/linux") (menu-bar-mode -1) + (if (string-equal system-type "darwin") (setq ns-auto-hide-menu-bar t))) + + +;; Native App Settings +(tool-bar-mode -1) + +;; Disable GUI scrollbars +(when (display-graphic-p) + (scroll-bar-mode -1)) + +;; Use spaces instead of tabs +(setq-default indent-tabs-mode nil) + + +;; Change font settings +(if (string-equal system-type "gnu/linux") + (add-to-list 'default-frame-alist '(font . "Hack 9")) + (if (string-equal system-type "darwin") + (add-to-list 'default-frame-alist '(font . "Menlo 12")))) + + +;; Colorscheme +(load-theme 'atom-one-dark t) + + +;; Line Height +(setq-default line-spacing 4) + + +;; Add transparency +(set-frame-parameter (selected-frame) 'alpha '(100 . 100)) +(add-to-list 'default-frame-alist '(alpha . (100 . 100))) +(put 'narrow-to-region 'disabled nil) +(put 'dired-find-alternate-file 'disabled nil) diff --git a/configs/shared/.tmux.conf b/configs/shared/.tmux.conf new file mode 100644 index 000000000000..9d1d151bcecd --- /dev/null +++ b/configs/shared/.tmux.conf @@ -0,0 +1,217 @@ +# change tmux leader +unbind C-b +set -g prefix C-q +bind C-q send-prefix + + +# COLORS! +set -g default-terminal "tmux-256color-italic" +set -ga terminal-overrides ",xterm-256color-italic:Tc" + + +#copy-paste fixes: http://evertpot.com/osx-tmux-vim-copy-paste-clipboard/ +# Copy-paste integration +set-option -g default-command "reattach-to-user-namespace -l zsh" + + +# Use vim keybindings in copy mode +setw -g mode-keys vi + + +# Setup 'v' to begin selection as in Vim +bind-key -t vi-copy v begin-selection +bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" + + +# Update default binding of `Enter` to also use copy-pipe +unbind -t vi-copy Enter +bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" + + +# Bind ']' to use pbpaste +bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer" + + +# fix for slow ESC issues +set -s escape-time 0 + + +# start window indicies at 1 +set -g base-index 1 + + +###################### +### DESIGN CHANGES ### +###################### + +# panes +set -g pane-border-fg black +set -g pane-active-border-fg brightred + +## Status bar design +# status line +set -g status-utf8 on +set -g status-justify left +set -g status-bg default +set -g status-fg colour12 +set -g status-interval 2 + +# messaging +set -g message-fg black +set -g message-bg yellow +set -g message-command-fg blue +set -g message-command-bg black + +#window mode +setw -g mode-bg colour6 +setw -g mode-fg colour0 + +# window status +setw -g window-status-format " #F#I:#W#F " +setw -g window-status-current-format " #F#I:#W#F " +setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W " +setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W " +setw -g window-status-current-bg colour0 +setw -g window-status-current-fg colour11 +setw -g window-status-current-attr dim +setw -g window-status-bg green +setw -g window-status-fg black +setw -g window-status-attr reverse + +# Info on left (I don't have a session display for now) +set -g status-left '' + +# The modes { +setw -g clock-mode-colour colour135 +setw -g mode-attr bold +setw -g mode-fg colour196 +setw -g mode-bg colour238 + +# } +# The panes { + +set -g pane-border-bg colour235 +set -g pane-border-fg colour238 +set -g pane-active-border-bg colour236 +set -g pane-active-border-fg colour51 + +# } +# The statusbar { + +set -g status-position bottom +set -g status-bg colour234 +set -g status-fg colour137 +set -g status-attr dim +set -g status-left '' +set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' +set -g status-right-length 50 +set -g status-left-length 20 + +setw -g window-status-current-fg colour81 +setw -g window-status-current-bg colour238 +setw -g window-status-current-attr bold +setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' + +setw -g window-status-fg colour138 +setw -g window-status-bg colour235 +setw -g window-status-attr none +setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' + +setw -g window-status-bell-attr bold +setw -g window-status-bell-fg colour255 +setw -g window-status-bell-bg colour1 + +# } +# The messages { + +set -g message-attr bold +set -g message-fg colour232 +set -g message-bg colour166 + +# } + + +# window naming nonsense +set-window-option -g automatic-rename on +set-window-option -g allow-rename off + + +# new windows carry over current working directory +bind c new-window -c '#{pane_current_path}' + + +# Make tmux work like vi +set-window-option -g mode-keys vi +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + + +# Easier window swaps +bind -n C-left swap-window -t -1 +bind -n C-right swap-window -t +1 + + +# Easier window moves +bind -n m-left previous-window +bind -n m-right next-window + + +# window resizing +bind -n S-Up resize-pane -U 5 +bind -n S-Down resize-pane -D 5 +bind -n S-Left resize-pane -L 10 +bind -n S-Right resize-pane -R 10 + + +# Option + number to jump to window +bind -n m-0 select-window -t 0 +bind -n m-1 select-window -t 1 +bind -n m-2 select-window -t 2 +bind -n m-3 select-window -t 3 +bind -n m-4 select-window -t 4 +bind -n m-5 select-window -t 5 +bind -n m-6 select-window -t 6 +bind -n m-7 select-window -t 7 +bind -n m-8 select-window -t 8 +bind -n m-9 select-window -t 9 + + +# Option + l to toggle between sessions +# bind -n m-l switch-client -l +bind -n m-s choose-session + + +# split window shortcuts, maintaing the working directory +bind | split-window -h -c '#{pane_current_path}' +bind \ split-window -h -c '#{pane_current_path}' +bind - split-window -v -c '#{pane_current_path}' +bind _ split-window -v -c '#{pane_current_path}' + +bind '"' split-window -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" + +# source '/usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' + +bind-key h set -g status + +set-option -g status on +set-option -g status-interval 2 +# set-option -g status-utf8 on +set-option -g status-justify "centre" +set-option -g status-left-length 60 +set-option -g status-right-length 90 +# set-option -g status-left "#(~/dotfiles/tmux-powerline/powerline.sh left)" +# set-option -g status-right "#(~/dotfiles/tmux-powerline/powerline.sh right)" + + +# Bindings for "christoomey/vim-tmux-navigator" +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" +bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" +bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" +bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" +bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" diff --git a/configs/shared/.vimrc b/configs/shared/.vimrc new file mode 100644 index 000000000000..e0476e3f12d1 --- /dev/null +++ b/configs/shared/.vimrc @@ -0,0 +1,544 @@ +" Set shell variable to "sh" if current shell is "fish shell" +if &shell =~# 'fish$' + set shell=sh +endif + + +" -- BEGIN: Vundle config -- +set nocompatible " be iMproved, required +filetype off " required + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() +" alternatively, pass a path where Vundle should install plugins +"call vundle#begin('~/some/path/here') + +" let Vundle manage Vundle, required +Plugin 'VundleVim/Vundle.vim' + +" The following are examples of different formats supported. +" Keep Plugin commands between vundle#begin/end. + +" Displays git information in airline. +Plugin 'tpope/vim-fugitive' + +" Displays git-tracked C*UD ops within gutter. +Plugin 'airblade/vim-gitgutter' + +" Fuzzy-finder +Plugin 'kien/ctrlp.vim' + +" Grep file contents +Plugin 'mileszs/ack.vim' + +" JS support +Plugin 'pangloss/vim-javascript' + +" Visual dir-tree navigation +Plugin 'scrooloose/nerdtree' + +" Syntax Highlighting Support +Plugin 'lambdatoast/elm.vim' + +" Elixir Plugins +Plugin 'elixir-lang/vim-elixir' +Plugin 'slashmili/alchemist.vim' +Plugin 'powerman/vim-plugin-AnsiEsc' + +" TypeScript Plugins +Plugin 'rschmukler/typescript-vim' + +" Themes +Plugin 'sickill/vim-monokai' +Plugin 'altercation/vim-colors-solarized' +Plugin 'mhartington/oceanic-next' + +" Executes shell commands and pipes output into new Vim buffer. +Plugin 'sjl/clam.vim' + +" Multiple cursors for simultaneous edits. +" NOTE: use <C-n> to run miltiple cursors not <C-d> +Plugin 'terryma/vim-multiple-cursors' + +" Visualize buffers +Plugin 'vim-airline/vim-airline' +Plugin 'vim-airline/vim-airline-themes' + +" Visually align assignments +Plugin 'godlygeek/tabular' + +" Visually Highlight and comment code. +Plugin 'tpope/vim-commentary' + +" Macros for quotes, parens, etc. +Plugin 'tpope/vim-surround' + +" Allows Plugins to be repeated with `.` character +Plugin 'tpope/vim-repeat' + +" Seamlessly navigate Vim and Tmux with similar bindings. +Plugin 'christoomey/vim-tmux-navigator' + +" Async `:make` for code linting etc. +Plugin 'neomake/neomake' + +" Color pack +Plugin 'flazz/vim-colorschemes' + +" Dash integration (macOS only) +Plugin 'rizzatti/dash.vim' + +" Better buffer mgt than CtrlP +Plugin 'yegappan/mru' + +Plugin 'zanglg/nova.vim' + +" Emulates Emacs's Helm Swoop search +Plugin 'pelodelfuego/vim-swoop' + +" Fish Shell support +Plugin 'dag/vim-fish' + +call vundle#end() " required +filetype plugin indent on " required +" Put your non-Plugin stuff after this line +" -- END: Vundle config -- + + +" Basic settings +" Thin cursor on INSERT mode +if has('nvim') + let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1 +endif + +set number +set wrap! +set tabstop=2 +set expandtab +set shiftwidth=2 +set background=dark + +syntax enable +colorscheme onedark + +set termguicolors + +set history=1000 +set undolevels=1000 + +set t_Co=255 + +" Support italics +highlight Comment cterm=italic + +" Changes <leader> to <space> character. +let mapleader = " " + + +" Auto resize window splits +autocmd VimResized * wincmd = + + +" Neomake Settings +autocmd! BufWritePost * Neomake + +" Elixir linting +let g:neomake_elixir_credo_maker = { + \ 'exe': 'mix', + \ 'args': ['credo', 'list', '%:p', '--format=oneline'], + \ 'errorformat': + \ '%W[F] %. %f:%l:%c %m,' . + \ '%W[F] %. %f:%l %m,' . + \ '%W[R] %. %f:%l:%c %m,' . + \ '%W[R] %. %f:%l %m,' . + \ '%I[C] %. %f:%l:%c %m,' . + \ '%I[C] %. %f:%l %m,' . + \ '%-Z%.%#' + \ } + + +let g:neomake_elixir_enabled_makers = ['mix', 'credo'] + +augroup my_error_signs + au! + autocmd ColorScheme * hi NeomakeErrorSign ctermfg=203 guifg=#ff5f5f + autocmd ColorScheme * hi NeomakeWarningSign ctermfg=209 guifg=#ffaf00 + autocmd ColorScheme * hi NeomakeInfoSign ctermfg=183 guifg=#dfafff + autocmd ColorScheme * hi NeomakeMessageSign ctermfg=27 guifg=#0087ff +augroup END + + +let g:neomake_error_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeErrorSign', + \ } + +let g:neomake_warning_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeWarningSign', + \ } + +let g:neomake_info_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeInfoSign', + \ } + +let g:neomake_message_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeMessageSign', + \ } + +function! <SID>LocationPrevious() + try + lprev + catch /^Vim\%((\a\+)\)\=:E553/ + llast + endtry +endfunction + +function! <SID>LocationNext() + try + lnext + catch /^Vim\%((\a\+)\)\=:E553/ + lfirst + endtry +endfunction + +nnoremap <Leader>[ :call <SID>LocationPrevious()<CR> +nnoremap <Leader>] :call <SID>LocationNext()<CR> + + +" Alchemist settings +let g:alchemist#elixir_erlang_src = '/usr/local/share/src' + + +" Airline Settings +" Enables the list of buffers. +let g:airline#extensions#tabline#enabled = 1 + +" Buffer numbers alongside files +let g:airline#extensions#tabline#buffer_nr_show = 1 + +" Shows the filename only. +let g:airline#extensions#tabline#fnamemod = ':t' + +" Allow glyphs in airline +let g:airline_powerline_fonts = 1 + +" Change Airline theme +let g:airline_theme = 'hybrid' + + +" Vim-Swoop Settings +" Edits colorscheme +let g:swoopHighlight = ["hi! link SwoopBufferLineHi Warning", "hi! link SwoopPatternHi Error"] + + +" Jump to buffers. +nmap <F1> :1b<CR> +nmap <F2> :2b<CR> +nmap <F3> :3b<CR> +nmap <F4> :4b<CR> +nmap <F5> :5b<CR> +nmap <F6> :6b<CR> +nmap <F7> :7b<CR> +nmap <F8> :8b<CR> +nmap <F9> :9b<CR> + + +" It's the twenty-first century...no swaps. +set noswapfile + + +" Allow visual tab completion in command mode +set wildmenu + + +" Show Vim commands as they're being input. +set showcmd + + +" Code folding +" set foldmethod=indent +" set foldnestmax=10 +" set nofoldenable +" set foldlevel=4 + + +" emulate ci" and ci' behavior +nnoremap ci( f(%ci( +nnoremap ci[ f[%ci[ + + +" extend functionality of <C-e> & <C-y> scrolling +nnoremap <C-e> <C-e>j +vnoremap <C-e> <C-e>j +nnoremap <C-y> <C-y>k +vnoremap <C-y> <C-y>k + + +" Opens all folds within the buffer +" nnoremap ZZ zR + +" Closes all folds within the buffer +" nnoremap zz zM + +" Opens all folds beneath the cursor +" NOTE: j is the character to go down +" nnoremap zJ zO + +" Opens single fold beneath the cursor +" NOTE: j is the character to go down +" nnoremap zj zo + +" Opens single fold beneath the cursor +" NOTE: k is the character to go down +" nnoremap zK zC + +" Opens single fold beneath the cursor +" NOTE: k is the character to go down +" nnoremap zk zc + + +" Lookup Dash word under cursor in Dash +nnoremap <leader>j :Dash<CR> + + +" Save shortcut +nnoremap <C-s> :w<CR> + + +" Switch to MRU'd buffer +nnoremap <leader><leader> <C-^> + + +" Alternative MRU to CtrlP MRU +nnoremap <leader>b :MRU<CR> + + +" Supports mouse interaction. +set mouse=a + + +" Highlights matches during a search. +set hlsearch + +" Clear highlight +noremap <leader>/ :nohlsearch<CR> + + +" backspace settings +set backspace=2 +set backspace=indent,eol,start + + +" Javascript specific variables +let g:javascript_plugin_jsdoc = 1 + +" GlobalListchars +set list +set listchars=tab:··,trail:·,nbsp:· + + +" Keeps everything concealed at all times. Even when cursor is on the word. +set conceallevel=1 +set concealcursor=nvic + + +" map jk to <Esc> +inoremap jk <Esc> + + +" Conventional Emacs line-editor defaults +" NOTE: <C-a> interferes w/ current tmux prefix +inoremap <C-a> <Esc>I +inoremap <C-e> <Esc>A + + +" Manage Vertical and Horizontal splits +nnoremap sl <Esc>:vs<CR><C-w>l +nnoremap sh <Esc>:vs<CR> +nnoremap sj <Esc>:sp<CR><C-w>j +nnoremap sk <Esc>:sp<CR> + + +" Delete (i.e. "close") the currently opened buffer +" TODO: unless it's a split window, which should be :q +nnoremap <leader>q :bdelete<CR> + + +" Set CtrlP runtime path +set runtimepath^=~/.vim/bundle/ctrlp.vim + + +" Buffer creation and management +" Buffer movement +nnoremap <Tab> :1bnext<CR> +nnoremap <S-Tab> :1bprevious<CR> + + +" make Y do what is intuitive given: +" D: deletes until EOL +" C: changes until EOL +" Y: (should) yank until EOL +nnoremap Y y$ + + +" scrolling and maintaing mouse position +" nnoremap <C-j> j<C-e> +" nnoremap <C-k> k<C-y> + + +" Shorter binding for window rotations +nnoremap <C-r> <C-w><C-r> + + +" remap redo key that is eclipsed by `rotate` currently +nnoremap U :redo<CR> + + +" Define highlighting groups +" NOTE: The ANSII aliases for colors will change when iTerm2 settings are +" changed. +highlight InterestingWord1 ctermbg=Magenta ctermfg=Black +highlight InterestingWord2 ctermbg=Blue ctermfg=Black + +" h1 highlighting +nnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR> +nnoremap <silent> <leader>x1 :execute '2match none'<CR> +vnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR> + +" h2 highlighting +nnoremap <silent> <leader>2 :execute '3match InterestingWord2 /\<<c-r><c-w>\>/'<CR> +nnoremap <silent> <leader>x2 :execute '3match none'<CR> + +"clear all highlighted groups +nnoremap <silent> <leader>xx :execute '2match none'<CR> :execute '3match none'<CR> hh + + +" pasteboard copy & paste +nnoremap <C-c> V"+y +vnoremap <C-c> "+y + +inoremap <C-v> <Esc>"+pa +" nnoremap <C-v> o<Esc>"+p +vnoremap <C-v> "+p + + +" Manage 80 char line limits +highlight OverLength1 ctermbg=Magenta ctermfg=Black +highlight OverLength2 ctermbg=LightMagenta ctermfg=Black +highlight OverLength3 ctermbg=White ctermfg=Black +" match OverLength3 /\%81v.\+/ +match OverLength2 /\%91v.\+/ +" match OverLength3 /\%101v.\+/ + + +" Toggle word-wrapping +nnoremap <leader>w :set wrap!<CR> + + +" Resize split to 10,20,...,100 chars +" Uncomment the next lines for support at those sizes. +" These bindings interfere with the highlight groups, however. +" Increases the width of a vertical split. +" nnoremap <leader>1 :vertical resize 10<CR> +" nnoremap <leader>2 :vertical resize 20<CR> +nnoremap <leader>3 :vertical resize 30<CR> +nnoremap <leader>4 :vertical resize 40<CR> +nnoremap <leader>5 :vertical resize 50<CR> +nnoremap <leader>6 :vertical resize 60<CR> +nnoremap <leader>7 :vertical resize 70<CR> +nnoremap <leader>8 :vertical resize 80<CR> +nnoremap <leader>9 :vertical resize 90<CR> +nnoremap <leader>0 :vertical resize 100<CR> + + +" Increases the height of a horizontal split. +nnoremap <leader>v1 :resize 5<CR> +nnoremap <leader>v2 :resize 10<CR> +nnoremap <leader>v3 :resize 15<CR> +nnoremap <leader>v4 :resize 20<CR> +nnoremap <leader>v5 :resize 25<CR> +nnoremap <leader>v6 :resize 30<CR> +nnoremap <leader>v7 :resize 35<CR> +nnoremap <leader>v8 :resize 40<CR> +nnoremap <leader>v9 :resize 45<CR> +nnoremap <leader>v0 :resize 50<CR> + + +" NERDTree settings +" Show hidden files by default. (Toggle with capital 'i') +let NERDTreeShowHidden = 1 + +" View Directory tree with ctrl + n +nnoremap <leader>n :NERDTreeToggle<CR> + +" View open buffer location in tree. +nnoremap <leader>f :NERDTreeFind<CR> + + +" BOL and EOL +nnoremap H ^ +vnoremap H ^ +nnoremap L $ +vnoremap L $ + + +" Search for visually selected text +vnoremap // y/<C-r>"<CR>N + + +" trim trailing whitespace on save +autocmd BufWritePre *.{js,py,tpl,less,html,ex,exs,txt} :%s/\s\+$//e + + +" Use .gitignore file to populate Ctrl-P +let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] + + +" Ignores dirs and files +let g:ctrlp_custom_ignore = { + \ 'dir': 'node_modules', + \ 'file': '\v\.(exe|dll|png|jpg|jpeg)$' +\} + + +" WIP: Run elixir tests on that line +" TODO: only register binding in *.exs? file extensions +nnoremap <leader>t :call ExTestToggle()<CR> + + +" Jumps from an Elixir module file to an Elixir test file. +fun! ExTestToggle() + if expand('%:e') == "ex" + + let test_file_name = expand('%:t:r') . "_test.exs" + let test_file_dir = substitute(expand('%:p:h'), "/lib/", "/test/", "") + let full_test_path = join([test_file_dir, test_file_name], "/") + + e `=full_test_path` + + elseif match(expand('%:t'), "_test.exs") != -1 + + let test_file_name = expand('%:t:r') + let offset_amt = strlen(test_file_name) - strlen("_test") + let module_file_name = strpart(test_file_name, 0, offset_amt) . ".ex" + let module_file_dir = substitute(expand('%:p:h'), "/test/", "/lib/", "") + let full_module_path = join([module_file_dir, module_file_name], "/") + + e `=full_module_path` + + endif +endfun + + +" Creates intermediate directories and file to match current buffer's filepath +fun! CreateNonExistingDirsAndFile() + ! echo "Creating directory..." && mkdir -p %:p:h && echo "Created directory." && echo "Creating file..." && touch %:t:p && echo "Created file." + + " Write the buffer to the recently created file. + w +endfun + diff --git a/configs/shared/.zsh_profile b/configs/shared/.zsh_profile new file mode 100644 index 000000000000..f533036acf9f --- /dev/null +++ b/configs/shared/.zsh_profile @@ -0,0 +1,97 @@ +export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/fzf/bin:$HOME/n/bin:$HOME/.cargo/bin + + +# Have zsh export variables for Emacs to track the cwd +if [ -n "$INSIDE_EMACS" ]; then + chpwd() { print -P "\033AnSiTc %d" } + print -P "\033AnSiTu %n" + print -P "\033AnSiTc %d" +fi + + +# make vim the default editor for commit messages etc +export EDITOR=$(which vim) + + +# update prompt to save space +PS1="${PS1} + " + + +echo "Welcome back, $USER" + + +# display the space available on each mounted Volume +df -hl + + +# use emacs bindings (default) for terminal input +set -o emacs + + +# aliases +source $HOME/pc_settings/aliases.sh + +# functions +source $HOME/pc_settings/functions/index.sh + +# setup keybindings for history functions +source $HOME/pc_settings/scripts/setup_keybindings.sh + +# setup emacs + shell configuration +source $HOME/pc_settings/emacs/index.sh + + +# BEGIN: bindkeys +bindkey "^R" history-incremental-search-backward + +bindkey -M viins 'jk' vi-cmd-mode +# END: bindkeys + +# export docker env variables +# re-enable this line when using docker otherwise you will receive +# a TLS error since docker-machine won't be running +# eval "$(docker-machine env default)" + +# run cmatrix command for 3 seconds before exiting +#. $HOME/pc_settings/.matrix_intro.sh + +# syntax highlighting for CLI; if not installed, run the following command +# brew install zsh-syntax-highlighting +source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + +# Regain control of CLI <C- mappings for vim keybindings +# RE: http://superuser.com/questions/588846/cannot-get-vim-to-remap-ctrls-to-w +stty -ixon + + +# Allows FZF to search hidden files (excluding .git repository) +export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -l -g ""' +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" + +# CTRL-Y - Paste the selected branch(es) into the command line +__bsel() { + local cmd="git branch -a | tr -d '* ' | sed 's/^remotes\/origin\///' | sort | uniq" + setopt localoptions pipefail 2> /dev/null + eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" $(__fzfcmd) -m "$@" | while read item; do + echo -n "${(q)item} " + done + local ret=$? + echo + return $ret +} + +fzf-branch-widget() { + LBUFFER="${LBUFFER}$(__bsel)" + local ret=$? + zle redisplay + typeset -f zle-line-init >/dev/null && zle zle-line-init + return $ret +} +zle -N fzf-branch-widget +bindkey '^Y' fzf-branch-widget + + +# Run Autojump at shell startup +[[ $(brew --prefix)/etc/profile.d/autojump.sh ]] && \ +. $(brew --prefix)/etc/profile.d/autojump.sh |