doomemacs/private/my-bindings.el

348 lines
9.6 KiB
EmacsLisp
Raw Normal View History

2015-06-06 06:40:33 -04:00
;;; my-bindings.el
(map!
"M-x" 'helm-M-x
"A-x" 'helm-M-x
2016-05-11 05:36:49 -04:00
"M-;" 'eval-expression
"A-;" 'eval-expression
2016-05-11 05:36:49 -04:00
"M-/" 'evil-commentary-line
"A-/" 'evil-commentary-line
2015-12-11 22:43:31 -05:00
"M-0" (λ! (text-scale-set 0))
"M-=" 'text-scale-increase
"M--" 'text-scale-decrease
2015-12-09 02:10:27 -05:00
;; debug
"<f9>" 'what-face
2016-05-20 22:37:30 -04:00
"M-b" 'doom:build
"M-t" 'doom:tab-create
"M-T" 'doom/tab-display
"A-`" 'os-switch-to-term
2016-05-20 22:37:30 -04:00
"C-`" 'doom/popup-toggle
"C-~" 'doom:repl
2016-05-20 22:37:30 -04:00
"M-w" 'doom/close-window-or-tab
"M-W" 'delete-frame
2016-05-20 22:37:30 -04:00
"M-n" 'doom/new-buffer
"M-N" 'doom/new-frame
2015-09-30 13:49:37 -04:00
;; Simpler window navigation
"C-j" 'evil-window-down
"C-k" 'evil-window-up
"C-h" 'evil-window-left
2016-02-04 19:00:03 -05:00
"C-l" 'evil-window-right
2015-09-30 13:49:37 -04:00
2016-05-20 22:37:30 -04:00
"A-j" 'doom/evil-window-resize-d
"A-k" 'doom/evil-window-resize-u
"A-h" 'doom/evil-window-resize-l
"A-l" 'doom/evil-window-resize-r
2015-12-09 02:10:27 -05:00
"C-<escape>" 'evil-emacs-state
:e "C-<escape>" 'evil-normal-state
2016-05-20 22:37:30 -04:00
:m "M-1" (λ! (doom:switch-to-tab 0))
:m "M-2" (λ! (doom:switch-to-tab 1))
:m "M-3" (λ! (doom:switch-to-tab 2))
:m "M-4" (λ! (doom:switch-to-tab 3))
:m "M-5" (λ! (doom:switch-to-tab 4))
:m "M-6" (λ! (doom:switch-to-tab 5))
:m "M-7" (λ! (doom:switch-to-tab 6))
:m "M-8" (λ! (doom:switch-to-tab 7))
:m "M-9" (λ! (doom:switch-to-tab 8))
2015-10-05 03:43:00 -04:00
2015-06-06 06:40:33 -04:00
(:when IS-MAC
"<A-left>" 'backward-word
"<A-right>" 'forward-word
2016-05-20 22:37:30 -04:00
"<M-backspace>" 'doom/backward-kill-to-bol-and-indent
2015-06-06 06:40:33 -04:00
"A-SPC" 'just-one-space
"M-a" 'mark-whole-buffer
"M-c" 'evil-yank
2016-02-23 13:11:41 -05:00
"M-o" 'helm-find-files
"M-q" 'evil-quit-all
2016-04-08 01:43:20 -04:00
"M-s" 'save-buffer
2015-06-06 06:40:33 -04:00
"M-v" 'clipboard-yank
"M-z" 'undo
"M-Z" 'redo
2016-05-20 22:37:30 -04:00
"C-M-f" 'doom:toggle-fullscreen
2016-05-20 22:37:30 -04:00
:m "M-j" 'doom/multi-next-line
:m "M-k" 'doom/multi-previous-line
2016-02-23 13:11:41 -05:00
2016-05-20 22:37:30 -04:00
:n "M-r" 'doom:eval-buffer
:v "M-r" 'doom:eval-region
2016-02-23 13:11:41 -05:00
2016-05-20 22:37:30 -04:00
:ni "<M-f1>" 'doom/dash-at-pt
;; Textmate-esque indent shift left/right
2016-05-20 22:37:30 -04:00
:i "M-]" 'doom/smart-indent
:i "M-[" 'doom/dumb-dedent
;; Restore osx text objects
:i "<A-backspace>" 'evil-delete-backward-word
2015-12-11 22:43:31 -05:00
:i "<A-delete>" (λ! (evil-forward-word) (evil-delete-backward-word)))
2015-06-06 06:40:33 -04:00
2015-08-21 12:40:04 -04:00
:m ";" 'evil-ex
(:leader
2016-05-20 22:37:30 -04:00
:nv "," 'doom/helm-buffers-dwim
2015-12-09 02:10:27 -05:00
:nv "<" 'helm-buffers-list
:nv "." 'helm-find-files
:nv ">" 'helm-projectile-find-file-in-known-projects
:nv "/" 'helm-projectile-find-file
:nv ";" 'helm-semantic-or-imenu
:nv ":" 'helm-imenu-in-all-buffers
:nv "]" 'helm-etags-select
:nv "a" 'helm-projectile-find-other-file
:nv "m" 'helm-recentf
:nv "M" 'helm-projectile-recentf ; recent PROJECT files
:nv "P" 'helm-projectile-switch-project
:v "=" 'align-regexp
:n "h" 'help-command
:nv "p" 'helm-show-kill-ring
2016-05-20 22:37:30 -04:00
:n "R" 'doom/reset-theme
:n "e" 'doom/flycheck-errors
2015-12-09 02:10:27 -05:00
:n "s" 'yas-visit-snippet-file
2016-05-20 22:37:30 -04:00
:n "S" 'doom/yas-find-file
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-11 16:51:04 -05:00
:n "D" 'vc-annotate
(:prefix "d"
2016-05-20 22:37:30 -04:00
:n "." 'doom/vcs-show-hunk
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-11 16:51:04 -05:00
:n "/" 'vc-diff
2016-05-20 22:37:30 -04:00
:n "s" 'doom/vcs-stage-hunk
:n "r" 'doom/vcs-revert-hunk)
2015-12-09 02:10:27 -05:00
:n "b" 'helm-bookmarks
2016-05-20 22:37:30 -04:00
:nv "l" 'doom/nlinum-toggle
2015-12-09 02:10:27 -05:00
:nv "qq" 'evil-save-and-quit
2016-05-20 22:37:30 -04:00
:nv "QQ" 'doom/kill-all-buffers-do-not-remember
2015-12-09 02:10:27 -05:00
2016-03-06 23:03:28 -05:00
;; Quick access to my dotfiles and emacs.d
2016-05-20 22:37:30 -04:00
:nv "E" 'doom/helm-find-in-emacsd
:nv "\\" 'doom/helm-find-in-dotfiles
2015-12-10 16:15:09 -05:00
2015-12-09 02:10:27 -05:00
;; Tmux
(:prefix "t"
2016-05-20 22:37:30 -04:00
:n "." 'doom/tmux-cd-to-here
:n "/" 'doom/tmux-cd-to-project
:v "r" 'doom:tmux)
2015-12-09 02:10:27 -05:00
;; Open with O/S
:n "O" 'os-reveal
(:prefix "o"
2016-05-13 00:30:20 -04:00
:n "o" 'os-open-in-default-program
:n "p" 'os-reveal-project
:n "b" 'os-open-in-browser
:n "u" 'os-upload
:n "U" 'os-upload-folder
:n "l" 'os-send-to-launchbar
:n "L" 'os-send-project-to-launchbar
:n "t" 'os-switch-to-term
:n "T" 'os-switch-to-term-and-cd)
2015-12-09 02:10:27 -05:00
;; Org notes
2016-05-20 22:37:30 -04:00
:n "X" 'doom/org
2015-12-09 02:10:27 -05:00
(:prefix "x"
2016-05-20 22:37:30 -04:00
:n "." 'doom/org-find-file
:n "/" 'doom/org-find-file-in-notes
:n "e" 'doom/org-find-exported-file))
(:localleader
2016-05-20 22:37:30 -04:00
:n "\\" 'doom/neotree
2016-04-14 12:54:25 -04:00
:n "]" 'imenu-list-minor-mode
2016-05-20 22:37:30 -04:00
:n "b" 'doom:build
:n "R" 'doom:repl
:v "R" 'doom:repl-eval
:v "r" 'doom:eval-region
2015-12-09 02:10:27 -05:00
(:prefix "r"
:n "e" 'emr-show-refactor-menu
2016-05-20 22:37:30 -04:00
:n "r" 'doom:eval-buffer))
:nv "K" 'smart-up
2015-06-06 06:40:33 -04:00
2015-10-05 03:43:00 -04:00
;; Don't move cursor on indent
2015-12-11 22:43:31 -05:00
:n "=" (λ! (save-excursion (call-interactively 'evil-indent)))
2015-12-09 02:10:27 -05:00
:v "=" 'evil-indent
2016-05-20 22:37:30 -04:00
:n "zr" 'doom/evil-open-folds
:n "zm" 'doom/evil-close-folds
:n "zx" 'doom/kill-real-buffer
2015-12-09 02:10:27 -05:00
:n "ZX" 'bury-buffer
;; These are intentionally reversed
2016-05-20 22:37:30 -04:00
:n "]b" 'doom/next-real-buffer
:n "[b" 'doom/previous-real-buffer
2016-05-20 22:37:30 -04:00
:m "]d" 'doom/vcs-next-hunk
:m "[d" 'doom/vcs-prev-hunk
:m "]e" 'doom/flycheck-next-error
:m "[e" 'doom/flycheck-previous-error
2015-12-29 23:37:43 -05:00
;; Switch tabs
2016-05-20 22:37:30 -04:00
:n "]w" 'doom:switch-to-tab-right
:n "[w" 'doom:switch-to-tab-left
:m "gt" 'doom:switch-to-tab-right
:m "gT" 'doom:switch-to-tab-left
2015-06-06 06:40:33 -04:00
;; Increment/decrement number under cursor
2015-12-09 02:10:27 -05:00
:n "g=" 'evil-numbers/inc-at-pt
:n "g-" 'evil-numbers/dec-at-pt
2016-02-18 05:09:59 -05:00
;; NOTE: Helm is too bulky for ffap (which I use for quick file navigation)
2015-12-23 03:46:42 -05:00
:n "gf" (λ! (helm-mode -1)
(call-interactively 'find-file-at-point)
2016-02-18 05:09:59 -05:00
(helm-mode 1))
2015-12-23 03:46:42 -05:00
2016-05-20 22:37:30 -04:00
:m "gD" 'doom/find-def
:n "gp" 'doom/reselect-paste
2015-12-09 02:10:27 -05:00
:n "gc" 'evil-commentary
:n "gx" 'evil-exchange
2016-05-20 22:37:30 -04:00
:n "gr" 'doom:eval-region
:n "gR" 'doom:eval-buffer
:v "gR" 'doom:eval-region-and-replace
2015-12-09 02:10:27 -05:00
:m "g]" 'smart-right
:m "g[" 'smart-left
2016-05-20 22:37:30 -04:00
:v "@" 'doom/evil-macro-on-all-lines
:n "g@" 'doom/evil-macro-on-all-lines
2015-12-09 02:10:27 -05:00
:v "." 'evil-repeat
2015-06-06 06:40:33 -04:00
;; vnoremap < <gv
2015-12-11 22:43:31 -05:00
:v "<" (λ! (evil-shift-left (region-beginning) (region-end))
(evil-normal-state)
(evil-visual-restore))
2015-06-06 06:40:33 -04:00
;; vnoremap > >gv
2015-12-11 22:43:31 -05:00
:v ">" (λ! (evil-shift-right (region-beginning) (region-end))
(evil-normal-state)
(evil-visual-restore))
2015-06-06 06:40:33 -04:00
2016-02-18 05:09:59 -05:00
;; undo/redo for regions (NOTE: Buggy!)
:nv "u" 'undo-tree-undo
:nv "C-r" 'undo-tree-redo
2015-06-06 06:40:33 -04:00
2015-12-09 02:10:27 -05:00
:v "*" 'evil-visualstar/begin-search-forward
:v "#" 'evil-visualstar/begin-search-backward
2015-06-06 06:40:33 -04:00
2016-02-18 05:09:59 -05:00
:n "Y" "y$"
2015-06-06 06:40:33 -04:00
;; paste from recent yank register; which isn't overwritten by deletes or
;; other operations.
2016-02-18 05:09:59 -05:00
:v "C-p" "\"0p"
2015-06-06 06:40:33 -04:00
2015-12-09 02:10:27 -05:00
:v "S" 'evil-surround-region
:v "v" 'er/expand-region
:v "V" 'er/contract-region
2015-06-06 06:40:33 -04:00
;; aliases for %
2015-12-09 02:10:27 -05:00
:m "%" 'evilmi-jump-items
2016-05-20 19:08:02 -04:00
:m [tab] (λ! (if (ignore-errors (hs-already-hidden-p))
(hs-toggle-hiding)
(call-interactively 'evilmi-jump-items)))
2015-06-06 06:40:33 -04:00
;; Textmate-esque newlines
2015-12-09 02:10:27 -05:00
:i "<backspace>" 'backward-delete-char-untabify
2016-05-20 22:37:30 -04:00
:i "<M-backspace>" 'doom/backward-kill-to-bol-and-indent
2015-12-09 02:10:27 -05:00
:i "<C-return>" 'evil-ret-and-indent
2015-06-06 06:40:33 -04:00
2016-04-08 14:07:16 -04:00
;; Emacsien motions for insert mode
:i "C-b" 'backward-word
:i "C-f" 'forward-word
2015-06-06 06:40:33 -04:00
;; escape from insert mode (more responsive than using key-chord-define)
:irv "C-g" 'evil-normal-state
2015-12-09 02:10:27 -05:00
:o "s" 'evil-surround-edit
:o "S" 'evil-Surround-edit
2015-06-06 06:40:33 -04:00
2016-02-04 19:00:03 -05:00
:n "!" 'rotate-text
2015-06-06 06:40:33 -04:00
2015-06-15 09:10:28 +02:00
(:map evil-window-map ; prefix "C-w"
2016-05-20 22:37:30 -04:00
"u" 'doom/undo-window-change
2015-11-10 18:10:32 -05:00
;; Jump to new splits
2016-05-20 22:37:30 -04:00
"s" 'doom/evil-window-split
"v" 'doom/evil-window-vsplit
2015-11-10 18:10:32 -05:00
;; Move window in one step
2016-05-20 22:37:30 -04:00
"H" (λ! (doom/evil-window-move 'left))
"J" (λ! (doom/evil-window-move 'down))
"K" (λ! (doom/evil-window-move 'up))
"L" (λ! (doom/evil-window-move 'right))
2016-05-20 22:37:30 -04:00
"C-u" 'doom/undo-window-change
"C-r" 'doom/redo-window-change
2015-12-23 03:46:42 -05:00
"C-h" 'evil-window-left
"C-j" 'evil-window-down
"C-k" 'evil-window-up
2016-01-07 01:11:02 -05:00
"C-l" 'evil-window-right
2015-06-15 09:10:28 +02:00
"C-w" 'ace-window
2015-12-11 22:43:31 -05:00
"C-S-w" (λ! (ace-window 4)) ; swap windows
"C-C" (λ! (ace-window 16))) ; delete windows
2015-06-15 09:10:28 +02:00
2016-05-20 19:08:02 -04:00
;; `evil-multiedit'
:v "R" 'evil-multiedit-match-all
:n "M-C-D" 'evil-multiedit-restore
:nv "M-d" 'evil-multiedit-match-and-next
:nv "M-D" 'evil-multiedit-match-and-prev
(:map evil-multiedit-state-map
:v "RET" 'evil-multiedit-toggle-or-restrict-region)
;; `yasnippet'
:i [(tab)] 'yas-expand
2016-05-20 22:37:30 -04:00
:v "<backtab>" 'doom/yas-insert-snippet
2016-05-20 19:08:02 -04:00
;; `auto-yasnippet'
:i "<C-tab>" 'aya-expand
:nv "<C-tab>" 'aya-create
2015-06-15 09:10:28 +02:00
;; Vim omni-complete emulation
2016-05-20 22:37:30 -04:00
:i "C-SPC" 'doom/company-complete
2015-12-09 02:10:27 -05:00
(:prefix "C-x"
2016-05-20 22:37:30 -04:00
:i "C-l" 'doom/company-whole-lines
:i "C-k" 'doom/company-dict-or-keywords
2015-12-09 02:10:27 -05:00
:i "C-f" 'company-files
:i "C-]" 'company-tags
:i "s" 'company-ispell
:i "C-s" 'company-yasnippet
2016-04-08 01:43:20 -04:00
:i "C-o" 'company-capf
2015-12-09 02:10:27 -05:00
:i "C-n" 'company-dabbrev-code
2015-12-11 22:43:31 -05:00
:i "C-p" (λ! (let ((company-selection-wrap-around t))
(call-interactively 'company-dabbrev-code)
(company-select-previous-or-abort))))
2015-06-06 06:40:33 -04:00
2015-06-15 09:10:28 +02:00
(:after company
(:map company-active-map
"C-o" 'company-search-kill-others
2015-11-17 02:13:57 -05:00
"C-n" 'company-select-next
"C-p" 'company-select-previous
2016-02-23 13:11:00 -05:00
"C-h" 'company-quickhelp-manual-begin
"C-S-h" 'company-show-doc-buffer
2015-06-15 09:10:28 +02:00
"C-S-s" 'company-search-candidates
"C-s" 'company-filter-candidates
2015-10-14 03:39:32 -04:00
"C-SPC" 'company-complete-common-or-cycle
2016-05-20 22:37:30 -04:00
[tab] 'doom/company-complete-common-or-complete-full
2015-06-15 09:10:28 +02:00
"<backtab>" 'company-select-previous
2015-12-11 22:43:31 -05:00
[escape] (λ! (company-abort) (evil-normal-state 1))
2015-08-01 14:40:19 +02:00
"<C-return>" 'helm-company)
2015-06-15 09:10:28 +02:00
(:map company-search-map
"C-n" 'company-search-repeat-forward
"C-p" 'company-search-repeat-backward
[escape] 'company-search-abort))
2015-06-06 06:40:33 -04:00
(:after help-mode
2015-12-09 02:10:27 -05:00
(:map help-map
2016-05-20 22:37:30 -04:00
"e" 'doom/popup-messages)
2015-06-06 06:40:33 -04:00
(:map help-mode-map
:n "]]" 'help-go-forward
2016-05-20 19:08:02 -04:00
:n "[[" 'help-go-back)))
2015-12-09 02:10:27 -05:00
;; Common unicode characters
2015-12-11 22:43:31 -05:00
(map! :i "A-o" (λ! (insert "ø"))
:i "A-O" (λ! (insert "Ø"))
2015-12-11 22:43:31 -05:00
:i "A--" (λ! (insert ""))
:i "A-_" (λ! (insert "")))
2015-10-13 00:47:40 -04:00
2015-06-06 06:40:33 -04:00
(provide 'my-bindings)
;;; my-bindings.el ends here