Update my-bindings

This commit is contained in:
Henrik Lissner 2015-06-15 09:10:28 +02:00
parent 0f3e301f5a
commit 8f0c54c07e

View file

@ -4,7 +4,9 @@
;; ... ;; ...
;; Uh. Good question. ;; Uh. Good question.
(@map (eval-when-compile (require 'core-defuns))
(bind!
- -
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Global keymaps ;; ;; Global keymaps ;;
@ -24,15 +26,16 @@
:m "M-j" "6j" :m "M-j" "6j"
:m "M-k" "6k" :m "M-k" "6k"
:n "M-k" 'narf:eval-buffer :n "M-r" 'narf:eval-buffer
:v "M-r" 'narf:eval-region
:n "M-d" 'dash-at-point :n "M-d" 'dash-at-point
:n "M-o" 'narf:ido-find-file :n "M-o" 'narf/ido-find-file
:n "M-O" 'narf:ido-find-project-file :n "M-O" 'narf/ido-find-project-file
(:when IS-MAC (:when IS-MAC
"<A-left>" 'backward-word "<A-left>" 'backward-word
"<A-right>" 'forward-word "<A-right>" 'forward-word
"<M-backspace>" 'narf:backward-kill-to-bol-and-indent "<M-backspace>" 'narf/backward-kill-to-bol-and-indent
"A-SPC" 'just-one-space "A-SPC" 'just-one-space
"M-a" 'mark-whole-buffer "M-a" 'mark-whole-buffer
"M-c" 'evil-yank "M-c" 'evil-yank
@ -48,91 +51,100 @@
;; Local keymaps ;; ;; Local keymaps ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:nmv ";" evil-ex :nmv ";" 'evil-ex
(:leader "m" (:prefix "," ; <leader>
:n "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list))) :n "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
:n "<" 'helm-buffers-list :n "<" 'helm-buffers-list
:n "." 'narf:ido-find-file :n "." 'narf/ido-find-file
:n ">" 'narf:ido-find-file-other-window :n ">" 'narf/ido-find-file-other-window
:n "/" 'helm-projectile-find-file :n "/" 'helm-projectile-find-file
:n ";" 'helm-semantic-or-imenu :n ";" 'helm-semantic-or-imenu
:n "]" 'helm-etags-select :n "]" 'helm-etags-select
:n "a" 'helm-projectile-find-other-file :n "a" 'helm-projectile-find-other-file
:n "E" 'narf::initfiles :n "E" 'narf:ido-find-file-in-emacsd
:n "h" 'helm-apropos :n "h" 'helm-apropos
:n "n" 'narf::notes :n "n" 'narf/ido-find-org-file
:n "m" 'helm-recentf :n "N" 'narf:org-search-files-or-headers
:n "m" 'narf/ido-recentf
:n "M" 'helm-projectile-recentf ; recent PROJECT files :n "M" 'helm-projectile-recentf ; recent PROJECT files
:n "p" 'helm-projectile-switch-project :n "p" 'helm-projectile-switch-project
:n "r" 'emr-show-refactor-menu :n "r" 'emr-show-refactor-menu
:v "=" 'align-regexp
:n "qq" 'evil-save-and-quit :n "qq" 'evil-save-and-quit
:n "QQ" (λ (let ((confirm-kill-emacs nil)) (narf::kill-buffers t) (evil-quit-all))) :n "QQ" (λ (let ((confirm-kill-emacs nil))
(narf:kill-all-buffers t)
(save-buffers-kill-terminal)))
;; insert lines in-place) ;; insert lines in-place)
:n "jj" (λ (save-excursion (evil-insert-newline-below))) :n "jj" (λ (save-excursion (evil-insert-newline-below)))
:n "kk" (λ (save-excursion (evil-insert-newline-above))) :n "kk" (λ (save-excursion (evil-insert-newline-above)))
:n "oo" 'narf:open-with :n "oo" 'narf-open-with
:n "ob" (λ (narf:open-with "Google Chrome")) :n "ob" (λ (narf-open-with "Google Chrome"))
:n "of" (λ (narf:open-with "Finder.app" default-directory)) :n "of" (λ (narf-open-with "Finder.app" default-directory))
:n "oF" (λ (narf:open-with "Finder.app" (narf/project-root))) :n "oF" (λ (narf-open-with "Finder.app" (narf/project-root)))
:n "ou" (λ (narf:open-with "Transmit")) :n "ou" (λ (narf-open-with "Transmit"))
:n "oU" (λ (narf:open-with "Transmit" default-directory)) :n "oU" (λ (narf-open-with "Transmit" default-directory))
:n "ol" (λ (narf:open-with "LaunchBar")) :n "ol" (λ (narf-open-with "LaunchBar"))
:n "oL" (λ (narf:open-with "LaunchBar" default-directory)) :n "oL" (λ (narf-open-with "LaunchBar" default-directory))
:n "ot" (λ (narf::tmux-chdir nil t)) :n "ot" (λ (narf:tmux-chdir nil t))
:n "oT" 'narf::tmux-chdir) :n "oT" 'narf:tmux-chdir)
(:localleader "\\" (:prefix "\\" ; <localleader>
:n "\\" 'narf:neotree-toggle :n "\\" 'narf/neotree-toggle
:n "." 'narf:neotree-find :n "." 'narf/neotree-find
:n ";" 'narf:nlinum-toggle :n ";" 'narf/nlinum-toggle
:n "=" 'toggle-transparency :n "=" 'toggle-transparency
:n "E" 'evil-emacs-state :n "E" 'evil-emacs-state
:n "]" 'next-buffer :n "]" 'next-buffer
:n "[" 'previous-buffer :n "[" 'previous-buffer
:n "s" (λ (narf::snippets t)) ; ido snippets dir :n "s" (λ (narf:yas-snippets t)) ; ido snippets dir
:n "g" 'diff-hl-diff-goto-hunk :n "g" 'diff-hl-diff-goto-hunk
:n "e" (λ (call-interactively 'flycheck-buffer) (flycheck-list-errors)) :n "e" (λ (call-interactively 'flycheck-buffer) (flycheck-list-errors))
:n "p" 'helm-show-kill-ring :n "p" 'helm-show-kill-ring
:n "b" 'helm-bookmarks :n "b" 'helm-bookmarks
:n "w" 'helm-wg) :n "w" 'helm-wg)
:m :remap "j" "gj"
:m :remap "k" "gk"
:n "Y" "y$" :n "Y" "y$"
:n "zr" 'narf:open-folds :n "zr" 'narf/evil-open-folds
:n "zm" 'narf:close-folds :n "zm" 'narf/evil-close-folds
:n "zx" 'narf:kill-real-buffer :n "zx" 'narf:kill-real-buffer
:n "zX" 'bury-buffer :n "zX" 'bury-buffer
:n "]b" 'narf:next-real-buffer :n "]b" 'narf/next-real-buffer
:n "[b" 'narf:previous-real-buffer :n "[b" 'narf/previous-real-buffer
:n "]w" 'wg-switch-to-workgroup-right :n "]w" 'wg-switch-to-workgroup-right
:n "[w" 'wg-switch-to-workgroup-left :n "[w" 'wg-switch-to-workgroup-left
:m "]g" 'diff-hl-next-hunk
:m "[g" 'diff-hl-previous-hunk
:m "]e" 'narf/flycheck-next-error
:m "[e" 'narf/flycheck-previous-error
;; don't move cursor on indent ;; Don't move cursor on indent
:n "=" (λ (save-excursion (call-interactively 'evil-indent))) :n "=" (λ (save-excursion (call-interactively 'evil-indent)))
:v "=" 'evil-indent
;; Increment/decrement number under cursor ;; Increment/decrement number under cursor
:n "g=" 'evil-numbers/inc-at-pt :n "g=" 'evil-numbers/inc-at-pt
:n "g-" 'evil-numbers/dec-at-pt :n "g-" 'evil-numbers/dec-at-pt
:n "gR" 'narf::eval-buffer :n "gR" 'narf:eval-buffer
:n "gc" 'evil-commentary :n "gc" 'evil-commentary
:n "gy" 'evil-commentary-yank :n "gy" 'evil-commentary-yank
:n "gx" 'evil-exchange
:n "gr" 'narf:eval-region
:v "gR" 'narf:eval-region-and-replace
:m "gl" 'narf:goto-line
:m "gs" 'evil-ace-jump-two-chars-mode
:m "g]" 'smart-down
:m "g[" 'smart-up
;; VISUAL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:v "." 'evil-repeat :v "." 'evil-repeat
:v "gR" 'narf::eval-region-and-replace
:v ",=" 'align-regexp
;; vnoremap < <gv ;; vnoremap < <gv
:v "<" (λ (evil-shift-left (region-beginning) (region-end)) :v "<" (λ (evil-shift-left (region-beginning) (region-end))
@ -144,8 +156,8 @@
(evil-visual-restore)) (evil-visual-restore))
;; undo/redo for regions ;; undo/redo for regions
;; "u" 'undo-tree-undo :nv "u" 'undo-tree-undo
;; "C-r" 'redo-tree-redo :nv "C-r" 'undo-tree-redo
:v "*" 'evil-visualstar/begin-search-forward :v "*" 'evil-visualstar/begin-search-forward
:v "#" 'evil-visualstar/begin-search-backward :v "#" 'evil-visualstar/begin-search-backward
@ -165,34 +177,23 @@
(hs-toggle-hiding) (hs-toggle-hiding)
(call-interactively 'evilmi-jump-items))) (call-interactively 'evilmi-jump-items)))
:m "]g" 'diff-hl-next-hunk ;; Restore osx text objects
:m "[g" 'diff-hl-previous-hunk
:m "]e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-next-error 'next-error)))
:m "[e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-previous-error 'previous-error)))
:m "gl" 'narf:goto-line
:m "gs" 'evil-ace-jump-two-chars-mode
:m "gx" 'evil-exchange
:m "gr" 'narf::eval-region
:m "g]" 'smart-down
:m "g[" 'smart-up
:i "<A-backspace>" 'evil-delete-backward-word :i "<A-backspace>" 'evil-delete-backward-word
:i "<A-delete>" (λ (evil-forward-word) (evil-delete-backward-word)) :i "<A-delete>" (λ (evil-forward-word) (evil-delete-backward-word))
:i ;; Newline magic ;; Newline magic
:i "<backspace>" 'backward-delete-char-untabify :i "<backspace>" 'backward-delete-char-untabify
:i "<M-backspace>" 'narf:backward-kill-to-bol-and-indent :i "<M-backspace>" 'narf/backward-kill-to-bol-and-indent
:i "<C-return>" 'evil-ret-and-indent :i "<C-return>" 'evil-ret-and-indent
:i ;; Textmate-esque indent shift left/right ;; Textmate-esque indent shift left/right
:i "M-[" "C-o m l C-o I DEL C-o ` l" :i "M-[" "C-o m l C-o I DEL C-o ` l"
:i "M-]" (λ (evil-shift-right (point-at-bol) (point-at-eol))) :i "M-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
:i "<backtab>" "M-[" :i "<backtab>" "M-["
;; escape from insert mode (more responsive than using key-chord-define) ;; escape from insert mode (more responsive than using key-chord-define)
:ir "j" 'narf:exit-mode-maybe :ir "j" 'narf:exit-mode-maybe
:ir "J" 'narf:exit-mode-maybe
:irv "C-g" 'evil-normal-state :irv "C-g" 'evil-normal-state
:o "s" 'evil-surround-edit :o "s" 'evil-surround-edit
@ -202,8 +203,18 @@
:v "!" 'rotate-region :v "!" 'rotate-region
:e [escape] 'evil-normal-state :e [escape] 'evil-normal-state
(:map evil-window-map ; prefix "C-w"
"u" 'winner-undo
"C-u" 'winner-undo
"C-r" 'winner-redo
"C-w" 'ace-window
"C-S-w" (λ (ace-window 4)) ; swap windows
"C-C" (λ (ace-window 16))) ; delete windows
;; Vim omni-complete emulation
:i "C-SPC" 'company-complete-common :i "C-SPC" 'company-complete-common
:i "C-x C-k" 'company-dictionary :i "C-x C-k" 'company-dict
:i "C-x C-f" 'company-files :i "C-x C-f" 'company-files
:i "C-x C-]" 'company-tags :i "C-x C-]" 'company-tags
:i "C-x s" 'company-ispell :i "C-x s" 'company-ispell
@ -214,6 +225,7 @@
(call-interactively 'company-dabbrev-code) (call-interactively 'company-dabbrev-code)
(company-select-previous-or-abort))) (company-select-previous-or-abort)))
(:after company
(:map company-active-map (:map company-active-map
"C-o" 'company-search-kill-others "C-o" 'company-search-kill-others
"C-n" 'company-select-next-or-abort "C-n" 'company-select-next-or-abort
@ -232,16 +244,7 @@
"C-n" 'company-search-repeat-forward "C-n" 'company-search-repeat-forward
"C-p" 'company-search-repeat-backward "C-p" 'company-search-repeat-backward
[escape] 'company-abort [escape] 'company-abort
:unset "C-w") :unset "C-w"))
(keymap evil-window-map
"u" 'winner-undo
"C-u" 'winner-undo
"C-r" 'winner-redo
"C-w" 'ace-window
"C-S-w" (λ (ace-window 4)) ; swap windows
"C-C" (λ (ace-window 16))) ; delete windows
(:after help-mode (:after help-mode
(:map help-mode-map (:map help-mode-map
@ -257,11 +260,7 @@
"C-a" 'move-beginning-of-line "C-a" 'move-beginning-of-line
"<s-left>" 'move-beginning-of-line "<s-left>" 'move-beginning-of-line
"<s-right>" 'move-beginning-of-line "<s-right>" 'move-beginning-of-line
"<s-backspace>" 'evil-delete-whole-line) "<s-backspace>" 'evil-delete-whole-line))
(:map evil-snipe-override-mode-map
"C-;" 'evil-snipe-repeat
"C-," 'evil-snipe-repeat-reverse))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -273,34 +272,34 @@
;; Restores "dumb" indentation to the tab key. This rustles a lot of ;; Restores "dumb" indentation to the tab key. This rustles a lot of
;; peoples' jimmies, apparently, but it's how I like it. ;; peoples' jimmies, apparently, but it's how I like it.
(@map :i "<tab>" 'narf:dumb-indent (bind! :i "<tab>" 'narf/dumb-indent
:i "<C-tab>" 'indent-for-tab-command :i "<C-tab>" 'indent-for-tab-command
;; No dumb-tab for lisp ;; No dumb-tab for lisp
:i :map lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command :i :map lisp-mode-map [remap narf/dumb-indent] 'indent-for-tab-command
:i :map emacs-lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command :i :map emacs-lisp-mode-map [remap narf/dumb-indent] 'indent-for-tab-command
;; Highjacks space/backspace to: ;; Highjacks space/backspace to:
;; a) delete spaces on either side of the cursor, if present ( | ) -> (|) ;; a) delete spaces on either side of the cursor, if present ( | ) -> (|)
;; b) allow backspace to delete space-indented blocks intelligently ;; b) allow backspace to delete space-indented blocks intelligently
;; c) and not do any of this magic when inside a string ;; c) and not do any of this magic when inside a string
:i "SPC" 'narf:inflate-space-maybe :i "SPC" 'narf/inflate-space-maybe
:i [remap backward-delete-char-untabify] 'narf:deflate-space-maybe :i [remap backward-delete-char-untabify] 'narf/deflate-space-maybe
:i [remap newline] 'narf:newline-and-indent :i [remap newline] 'narf/newline-and-indent
;; Smarter move-to-beginning-of-line ;; Smarter move-to-beginning-of-line
:i [remap move-beginning-of-line] 'narf:move-to-bol :i [remap move-beginning-of-line] 'narf/move-to-bol
;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist ;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist
:i "C-e" 'narf:move-to-eol :i "C-e" 'narf/move-to-eol
:i "C-u" 'narf:backward-kill-to-bol-and-indent :i "C-u" 'narf/backward-kill-to-bol-and-indent
;; Fixes delete ;; Fixes delete
:i "<kp-delete>" 'delete-char :i "<kp-delete>" 'delete-char
;; Fix osx keymappings and then some ;; Fix osx keymappings and then some
:i "<M-left>" 'narf:move-to-bol :i "<M-left>" 'narf/move-to-bol
:i "<M-right>" 'narf:move-to-eol :i "<M-right>" 'narf/move-to-eol
:i "<M-up>" 'beginning-of-buffer :i "<M-up>" 'beginning-of-buffer
:i "<M-down>" 'end-of-buffer :i "<M-down>" 'end-of-buffer
:i "<C-up>" 'smart-up :i "<C-up>" 'smart-up
@ -316,13 +315,13 @@
:ni "<S-M-return>" 'evil-open-above :ni "<S-M-return>" 'evil-open-above
;; Make ESC quit all the things ;; Make ESC quit all the things
:e [escape] narf/minibuffer-quit :e [escape] 'narf-minibuffer-quit
(:map (minibuffer-local-map (:map (minibuffer-local-map
minibuffer-local-ns-map minibuffer-local-ns-map
minibuffer-local-completion-map minibuffer-local-completion-map
minibuffer-local-must-match-map minibuffer-local-must-match-map
minibuffer-local-isearch-map) minibuffer-local-isearch-map)
[escape] 'narf/minibuffer-quit) [escape] 'narf-minibuffer-quit)
:map read-expression-map "C-w" 'evil-delete-backward-word :map read-expression-map "C-w" 'evil-delete-backward-word
@ -332,5 +331,9 @@
"<left-margin> <drag-mouse-1>" 'narf/mouse-select-line "<left-margin> <drag-mouse-1>" 'narf/mouse-select-line
"<left-margin> <double-mouse-1>" 'narf/mouse-select-block) "<left-margin> <double-mouse-1>" 'narf/mouse-select-block)
;; Disable the global drag-mouse map; clicking in new buffers often sends evil
;; into visual mode, which is UN...ACCEPTAABBLLLEEEE!
(global-unset-key (kbd "<drag-mouse-1>"))
(provide 'my-bindings) (provide 'my-bindings)
;;; my-bindings.el ends here ;;; my-bindings.el ends here