2015-06-06 06:40:33 -04:00
|
|
|
|
;;; my-bindings.el
|
|
|
|
|
|
|
|
|
|
;; Minimalistic key mapping! Why go so far for this?
|
|
|
|
|
;; ...
|
|
|
|
|
;; Uh. Good question.
|
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
(eval-when-compile (require 'core-defuns))
|
|
|
|
|
|
|
|
|
|
(bind!
|
2015-06-06 06:40:33 -04:00
|
|
|
|
-
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Global keymaps ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2015-11-21 19:36:29 -05:00
|
|
|
|
"M-x" 'helm-M-x
|
2015-06-06 06:40:33 -04:00
|
|
|
|
"M-;" 'eval-expression
|
|
|
|
|
"M-/" 'evil-commentary-line
|
2015-11-17 02:13:57 -05:00
|
|
|
|
|
2015-11-21 19:36:29 -05:00
|
|
|
|
"A-x" 'helm-M-x
|
2015-11-17 02:13:57 -05:00
|
|
|
|
"A-;" 'eval-expression
|
|
|
|
|
"A-/" 'evil-commentary-line
|
|
|
|
|
|
|
|
|
|
(:when window-system
|
2015-11-21 19:36:29 -05:00
|
|
|
|
"M-0" (λ (text-scale-set 0))
|
|
|
|
|
"M-=" 'text-scale-increase
|
|
|
|
|
"M--" 'text-scale-decrease)
|
2015-11-17 02:13:57 -05:00
|
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
|
"M-b" 'narf:build
|
|
|
|
|
"M-t" 'helm-projectile-find-file
|
2015-10-13 00:47:40 -04:00
|
|
|
|
"A-`" 'narf-switch-to-iterm
|
2015-11-19 05:55:21 -05:00
|
|
|
|
"C-`" 'narf/popup-toggle
|
2015-11-17 02:13:57 -05:00
|
|
|
|
"<f9>" 'what-face
|
2015-11-04 01:20:07 -05:00
|
|
|
|
|
2015-11-08 17:57:41 -05:00
|
|
|
|
"M-w" 'evil-window-delete
|
2015-11-17 02:13:57 -05:00
|
|
|
|
"M-W" 'delete-frame
|
2015-11-08 17:57:41 -05:00
|
|
|
|
"M-n" (λ (switch-to-buffer (generate-new-buffer "*new*")))
|
|
|
|
|
"M-N" (λ (let ((nlinum-p (and (featurep 'nlinum)
|
|
|
|
|
(memq 'nlinum--setup-window window-configuration-change-hook))))
|
|
|
|
|
;; Disable nlinum to fix elusive "invalid face linum" bug
|
|
|
|
|
(remove-hook 'window-configuration-change-hook 'nlinum--setup-window t)
|
|
|
|
|
(let ((frame (new-frame))
|
|
|
|
|
(frame-name (format "*new-%s*" (length narf-wg-frames))))
|
|
|
|
|
(with-selected-frame frame
|
|
|
|
|
(wg-create-workgroup frame-name t)
|
|
|
|
|
(add-to-list 'narf-wg-frames (cons frame frame-name))))
|
|
|
|
|
(when nlinum-p
|
|
|
|
|
(add-hook 'window-configuration-change-hook 'nlinum--setup-window nil t))))
|
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
|
|
|
|
|
"C-l" 'evil-window-right
|
|
|
|
|
|
2015-11-10 18:10:32 -05:00
|
|
|
|
:m "M-j" 'narf/multi-next-line
|
|
|
|
|
:m "M-k" 'narf/multi-previous-line
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:n "M-r" 'narf:eval-buffer
|
|
|
|
|
:v "M-r" 'narf:eval-region
|
|
|
|
|
:n "M-o" 'narf/ido-find-file
|
|
|
|
|
:n "M-O" 'narf/ido-find-project-file
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-11-21 19:36:29 -05:00
|
|
|
|
:m "M-1" (λ (narf:switch-to-workgroup-at-index 0))
|
|
|
|
|
:m "M-2" (λ (narf:switch-to-workgroup-at-index 1))
|
|
|
|
|
:m "M-3" (λ (narf:switch-to-workgroup-at-index 2))
|
|
|
|
|
:m "M-4" (λ (narf:switch-to-workgroup-at-index 3))
|
|
|
|
|
:m "M-5" (λ (narf:switch-to-workgroup-at-index 4))
|
|
|
|
|
:m "M-6" (λ (narf:switch-to-workgroup-at-index 5))
|
|
|
|
|
:m "M-7" (λ (narf:switch-to-workgroup-at-index 6))
|
|
|
|
|
:m "M-8" (λ (narf:switch-to-workgroup-at-index 7))
|
|
|
|
|
:m "M-9" (λ (narf:switch-to-workgroup-at-index 8))
|
2015-10-05 03:43:00 -04:00
|
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
|
(:when IS-MAC
|
2015-11-21 19:36:29 -05:00
|
|
|
|
:ni "M-d" 'dash-at-point
|
|
|
|
|
|
2015-11-17 02:13:57 -05:00
|
|
|
|
;; Add animated transitions to OSX emacs
|
|
|
|
|
"M-w" (λ (if window-system
|
|
|
|
|
(mac-start-animation (get-buffer-window) :type 'fade-out :duration 0.25))
|
|
|
|
|
(call-interactively 'evil-window-delete))
|
|
|
|
|
"M-W" (λ (let ((data (assq (selected-frame) narf-wg-frames)))
|
|
|
|
|
(if data
|
|
|
|
|
(progn (wg-delete-workgroup (wg-get-workgroup (cdr data)))
|
|
|
|
|
(delete-frame (car data)))
|
|
|
|
|
(delete-frame))))
|
|
|
|
|
"M-n" (λ (if window-system
|
|
|
|
|
(mac-start-animation (get-buffer-window) :type 'fade-out :duration 0.25))
|
|
|
|
|
(switch-to-buffer (generate-new-buffer "*new*")))
|
|
|
|
|
|
2015-10-05 03:43:00 -04:00
|
|
|
|
;; Textmate-esque indent shift left/right
|
2015-10-28 17:28:41 -04:00
|
|
|
|
:i "M-[" (kbd "C-o m l C-o I DEL C-o ` l")
|
2015-10-05 03:43:00 -04:00
|
|
|
|
:i "M-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
|
|
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
|
"<A-left>" 'backward-word
|
|
|
|
|
"<A-right>" 'forward-word
|
2015-06-15 09:10:28 +02:00
|
|
|
|
"<M-backspace>" 'narf/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
|
|
|
|
|
"M-s" 'save-buffer
|
|
|
|
|
"M-v" 'clipboard-yank
|
|
|
|
|
"M-q" 'evil-quit-all
|
|
|
|
|
"M-z" 'undo
|
|
|
|
|
"M-Z" 'redo
|
|
|
|
|
"C-M-f" 'narf:toggle-fullscreen)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Local keymaps ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2015-08-21 12:40:04 -04:00
|
|
|
|
:m ";" 'evil-ex
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-10-05 03:43:00 -04:00
|
|
|
|
;; <leader>
|
|
|
|
|
(:prefix ","
|
2015-10-23 04:42:34 -04:00
|
|
|
|
:nv "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
|
2015-11-10 18:10:32 -05:00
|
|
|
|
:nv "<" 'helm-buffers-list
|
2015-10-23 04:42:34 -04:00
|
|
|
|
: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 "E" (λ (in! narf-emacs-dir (helm-projectile-find-file)))
|
|
|
|
|
:nv "m" 'helm-recentf
|
|
|
|
|
:nv "M" 'helm-projectile-recentf ; recent PROJECT files
|
|
|
|
|
:nv "p" 'helm-projectile-switch-project
|
|
|
|
|
:v "=" 'align-regexp
|
|
|
|
|
:nv "r" 'emr-show-refactor-menu
|
|
|
|
|
|
|
|
|
|
:nv "qq" 'evil-save-and-quit
|
|
|
|
|
:nv "QQ" 'narf/kill-all-buffers-do-not-remember
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-11-10 18:10:32 -05:00
|
|
|
|
:n "oo" 'narf-open-with
|
|
|
|
|
:n "ob" (λ (narf-open-with "Google Chrome"))
|
|
|
|
|
:n "of" (λ (narf-open-with "Finder.app" default-directory))
|
|
|
|
|
:n "oF" (λ (narf-open-with "Finder.app" (narf/project-root)))
|
|
|
|
|
:n "ou" (λ (narf-open-with "Transmit"))
|
|
|
|
|
:n "oU" (λ (narf-open-with "Transmit" default-directory))
|
|
|
|
|
:n "ol" (λ (narf-open-with "LaunchBar"))
|
|
|
|
|
:n "oL" (λ (narf-open-with "LaunchBar" default-directory))
|
|
|
|
|
:n "ot" (λ (narf:tmux-chdir nil t))
|
2015-11-21 19:26:17 -05:00
|
|
|
|
:n "oT" 'narf:tmux-chdir
|
|
|
|
|
|
|
|
|
|
;; Org
|
|
|
|
|
:nv "n." (λ (in! org-directory (let ((helm-ff-skip-boring-files t)) (helm-find-files-1 org-directory))))
|
|
|
|
|
:nv "n/" 'narf/helm-org-search
|
|
|
|
|
:nv "np" 'narf/helm-org-projects
|
|
|
|
|
:nv "nc" 'narf/helm-org-contacts
|
|
|
|
|
:nv "ni" 'narf/helm-org-invoices
|
|
|
|
|
:nv "nw" 'narf/helm-org-writing)
|
2015-06-15 09:10:28 +02:00
|
|
|
|
|
2015-10-05 03:43:00 -04:00
|
|
|
|
;; <localleader>
|
|
|
|
|
(:prefix "\\"
|
2015-11-03 23:45:15 -05:00
|
|
|
|
:nv "\\" 'narf/neotree-toggle
|
|
|
|
|
:nv "|" 'narf-switch-to-iterm
|
|
|
|
|
:nv "." 'narf/neotree-find
|
|
|
|
|
:nv ";" 'narf/nlinum-toggle
|
|
|
|
|
:nv "E" 'evil-emacs-state
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-11-17 02:13:57 -05:00
|
|
|
|
:n "]" 'next-buffer
|
|
|
|
|
:n "[" 'previous-buffer
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-11-17 02:13:57 -05:00
|
|
|
|
:n "c" 'narf/reset-theme
|
|
|
|
|
:n "s" (λ (narf:yas-snippets t)) ; ido snippets dir
|
|
|
|
|
:n "g" 'diff-hl-diff-goto-hunk
|
|
|
|
|
:n "e" (λ (call-interactively 'flycheck-buffer) (flycheck-list-errors))
|
|
|
|
|
:n "p" 'helm-show-kill-ring
|
|
|
|
|
:n "b" 'helm-bookmarks
|
|
|
|
|
:n "w" 'narf:helm-wg
|
|
|
|
|
:n "W" 'narf:workgroup-display)
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-11-21 19:36:29 -05:00
|
|
|
|
:n "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
|
|
|
|
|
:n "=" (λ (save-excursion (call-interactively 'evil-indent)))
|
|
|
|
|
:v "=" 'evil-indent
|
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:n "zr" 'narf/evil-open-folds
|
|
|
|
|
:n "zm" 'narf/evil-close-folds
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:n "zx" 'narf:kill-real-buffer
|
2015-11-17 02:13:57 -05:00
|
|
|
|
:n "ZX" 'bury-buffer
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:n "]b" 'narf/next-real-buffer
|
|
|
|
|
:n "[b" 'narf/previous-real-buffer
|
|
|
|
|
:m "]g" 'diff-hl-next-hunk
|
|
|
|
|
:m "[g" 'diff-hl-previous-hunk
|
|
|
|
|
:m "]e" 'narf/flycheck-next-error
|
|
|
|
|
:m "[e" 'narf/flycheck-previous-error
|
2015-10-05 03:43:00 -04:00
|
|
|
|
;; Switch workgroups
|
2015-11-04 01:20:07 -05:00
|
|
|
|
:n "]w" 'narf:switch-to-workgroup-right
|
|
|
|
|
:n "[w" 'narf:switch-to-workgroup-left
|
2015-10-05 03:43:00 -04:00
|
|
|
|
:m "gt" 'narf:switch-to-workgroup-right
|
|
|
|
|
:m "gT" 'narf:switch-to-workgroup-left
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
|
|
;; Increment/decrement number under cursor
|
|
|
|
|
:n "g=" 'evil-numbers/inc-at-pt
|
|
|
|
|
:n "g-" 'evil-numbers/dec-at-pt
|
2015-10-28 17:28:41 -04:00
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:n "gR" 'narf:eval-buffer
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:n "gc" 'evil-commentary
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:n "gx" 'evil-exchange
|
|
|
|
|
:n "gr" 'narf:eval-region
|
|
|
|
|
:v "gR" 'narf:eval-region-and-replace
|
2015-06-24 15:34:46 +02:00
|
|
|
|
:m "gl" 'avy-goto-line
|
2015-11-03 23:44:54 -05:00
|
|
|
|
:m "g]" 'smart-right
|
|
|
|
|
:m "g[" 'smart-left
|
2015-10-28 17:28:41 -04:00
|
|
|
|
:no "g@" 'narf/evil-macro-on-all-lines
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
|
|
:v "." 'evil-repeat
|
|
|
|
|
|
|
|
|
|
;; vnoremap < <gv
|
|
|
|
|
:v "<" (λ (evil-shift-left (region-beginning) (region-end))
|
|
|
|
|
(evil-normal-state)
|
|
|
|
|
(evil-visual-restore))
|
|
|
|
|
;; vnoremap > >gv
|
|
|
|
|
:v ">" (λ (evil-shift-right (region-beginning) (region-end))
|
|
|
|
|
(evil-normal-state)
|
|
|
|
|
(evil-visual-restore))
|
|
|
|
|
|
|
|
|
|
;; undo/redo for regions
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:nv "u" 'undo-tree-undo
|
|
|
|
|
:nv "C-r" 'undo-tree-redo
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
|
|
:v "*" 'evil-visualstar/begin-search-forward
|
|
|
|
|
:v "#" 'evil-visualstar/begin-search-backward
|
|
|
|
|
|
|
|
|
|
;; paste from recent yank register; which isn't overwritten by deletes or
|
|
|
|
|
;; other operations.
|
2015-11-17 02:13:57 -05:00
|
|
|
|
:n "Y" "y$"
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:v "P" "\"0p"
|
|
|
|
|
|
|
|
|
|
:v "S" 'evil-surround-region
|
|
|
|
|
:v "R" 'evil-iedit-state/iedit-mode ; edit all instances of marked region
|
|
|
|
|
:v "v" 'er/expand-region
|
|
|
|
|
:v "V" 'er/contract-region
|
|
|
|
|
|
|
|
|
|
;; aliases for %
|
|
|
|
|
:m "%" 'evilmi-jump-items
|
2015-10-28 17:28:41 -04:00
|
|
|
|
:m [tab] (λ (cond ((eq major-mode 'org-mode)
|
|
|
|
|
(org-cycle))
|
2015-11-10 18:10:32 -05:00
|
|
|
|
(t (if (ignore-errors (hs-already-hidden-p))
|
|
|
|
|
(hs-toggle-hiding)
|
|
|
|
|
(call-interactively 'evilmi-jump-items)))))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
;; Restore osx text objects
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:i "<A-backspace>" 'evil-delete-backward-word
|
|
|
|
|
:i "<A-delete>" (λ (evil-forward-word) (evil-delete-backward-word))
|
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
;; Newline magic
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:i "<backspace>" 'backward-delete-char-untabify
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:i "<M-backspace>" 'narf/backward-kill-to-bol-and-indent
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:i "<C-return>" 'evil-ret-and-indent
|
2015-11-21 19:36:29 -05:00
|
|
|
|
:i "<C-SPC>" (λ (insert ", "))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
|
|
;; escape from insert mode (more responsive than using key-chord-define)
|
|
|
|
|
:ir "j" 'narf:exit-mode-maybe
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:ir "J" 'narf:exit-mode-maybe
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:irv "C-g" 'evil-normal-state
|
|
|
|
|
|
|
|
|
|
:o "s" 'evil-surround-edit
|
|
|
|
|
:o "S" 'evil-Surround-edit
|
|
|
|
|
|
|
|
|
|
:n "!" 'rotate-word-at-point
|
|
|
|
|
:v "!" 'rotate-region
|
|
|
|
|
:e [escape] 'evil-normal-state
|
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
(:map evil-window-map ; prefix "C-w"
|
2015-11-17 02:13:38 -05:00
|
|
|
|
"u" 'narf/undo-window-change
|
2015-11-10 18:10:32 -05:00
|
|
|
|
|
|
|
|
|
;; Jump to new splits
|
|
|
|
|
"s" 'narf/evil-window-split
|
|
|
|
|
"v" 'narf/evil-window-vsplit
|
|
|
|
|
|
2015-11-17 02:13:38 -05:00
|
|
|
|
;; Move window in one step
|
|
|
|
|
"H" 'narf/evil-window-move-left
|
|
|
|
|
"J" 'narf/evil-window-move-down
|
|
|
|
|
"K" 'narf/evil-window-move-up
|
|
|
|
|
"L" 'narf/evil-window-move-right
|
|
|
|
|
|
|
|
|
|
"C-u" 'narf/undo-window-change
|
|
|
|
|
"C-r" 'narf/redo-window-change
|
2015-07-03 00:26:46 +02:00
|
|
|
|
"C-h" 'evil-window-left ; don't accidentally invoke help
|
2015-07-26 13:15:49 +02:00
|
|
|
|
"C-j" 'evil-window-down ; don't accidentally invoke help
|
|
|
|
|
"C-k" 'evil-window-up ; don't accidentally invoke help
|
|
|
|
|
"C-l" 'evil-window-right ; don't accidentally invoke help
|
2015-06-15 09:10:28 +02:00
|
|
|
|
|
|
|
|
|
"C-w" 'ace-window
|
|
|
|
|
"C-S-w" (λ (ace-window 4)) ; swap windows
|
|
|
|
|
"C-C" (λ (ace-window 16))) ; delete windows
|
|
|
|
|
|
|
|
|
|
;; Vim omni-complete emulation
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:i "C-SPC" 'company-complete-common
|
2015-06-15 09:10:28 +02:00
|
|
|
|
:i "C-x C-k" 'company-dict
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:i "C-x C-f" 'company-files
|
|
|
|
|
:i "C-x C-]" 'company-tags
|
|
|
|
|
:i "C-x s" 'company-ispell
|
|
|
|
|
:i "C-x C-s" 'company-yasnippet
|
|
|
|
|
:i "C-x C-o" 'company-semantic
|
|
|
|
|
:i "C-x C-n" 'company-dabbrev-code
|
|
|
|
|
:i "C-x C-p" (λ (let ((company-selection-wrap-around t))
|
|
|
|
|
(call-interactively 'company-dabbrev-code)
|
|
|
|
|
(company-select-previous-or-abort)))
|
|
|
|
|
|
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
|
|
|
|
|
"C-h" 'company-show-doc-buffer
|
2015-06-15 09:10:28 +02:00
|
|
|
|
"C-S-h" 'company-show-location
|
|
|
|
|
"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
|
|
|
|
|
[tab] 'narf/company-complete-common-or-complete-full
|
2015-06-15 09:10:28 +02:00
|
|
|
|
"<backtab>" 'company-select-previous
|
|
|
|
|
[escape] 'company-abort
|
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
|
2015-08-01 14:40:19 +02:00
|
|
|
|
[escape] 'company-abort))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
|
|
(:after help-mode
|
|
|
|
|
(:map help-mode-map
|
|
|
|
|
:n "]]" 'help-go-forward
|
|
|
|
|
:n "[[" 'help-go-back
|
|
|
|
|
:n "<escape>" (λ (kill-buffer)
|
2015-11-19 05:55:21 -05:00
|
|
|
|
(if (narf/popup-p (current-buffer))
|
|
|
|
|
(narf/popup-close)
|
2015-06-06 06:40:33 -04:00
|
|
|
|
(evil-window-delete)))))
|
|
|
|
|
|
2015-11-21 19:36:29 -05:00
|
|
|
|
(:map view-mode-map
|
|
|
|
|
"<escape>" 'View-quit-all)
|
|
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
|
(:map evil-ex-completion-map
|
|
|
|
|
"C-r" 'evil-ex-paste-from-register ; registers in ex-mode
|
|
|
|
|
"C-a" 'move-beginning-of-line
|
|
|
|
|
"<s-left>" 'move-beginning-of-line
|
|
|
|
|
"<s-right>" 'move-beginning-of-line
|
2015-06-15 09:10:28 +02:00
|
|
|
|
"<s-backspace>" 'evil-delete-whole-line))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-11-08 17:59:11 -05:00
|
|
|
|
;; Line-wise mouse selection on margin
|
|
|
|
|
(global-set-key (kbd "<left-margin> <down-mouse-1>") 'narf/mouse-drag-line)
|
|
|
|
|
(global-set-key (kbd "<left-margin> <mouse-1>") 'narf/mouse-select-line)
|
|
|
|
|
(global-set-key (kbd "<left-margin> <drag-mouse-1>") 'narf/mouse-select-line)
|
|
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Keymap fixes ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;; This section is dedicated to keymaps that "fix" certain keys so
|
|
|
|
|
;; that they behave more like vim (or how I like it).
|
|
|
|
|
|
|
|
|
|
;; Restores "dumb" indentation to the tab key. This rustles a lot of
|
|
|
|
|
;; peoples' jimmies, apparently, but it's how I like it.
|
2015-11-17 02:13:57 -05:00
|
|
|
|
(bind! :i "<tab>" 'narf/dumb-indent
|
|
|
|
|
:i "<C-tab>" 'indent-for-tab-command
|
2015-06-15 09:10:28 +02:00
|
|
|
|
|
|
|
|
|
;; No dumb-tab for lisp
|
|
|
|
|
: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
|
|
|
|
|
|
|
|
|
|
;; Highjacks space/backspace to:
|
|
|
|
|
;; a) delete spaces on either side of the cursor, if present ( | ) -> (|)
|
|
|
|
|
;; b) allow backspace to delete space-indented blocks intelligently
|
|
|
|
|
;; c) and not do any of this magic when inside a string
|
|
|
|
|
:i "SPC" 'narf/inflate-space-maybe
|
|
|
|
|
:i [remap backward-delete-char-untabify] 'narf/deflate-space-maybe
|
|
|
|
|
:i [remap newline] 'narf/newline-and-indent
|
|
|
|
|
|
|
|
|
|
;; Smarter move-to-beginning-of-line
|
|
|
|
|
:i [remap move-beginning-of-line] 'narf/move-to-bol
|
|
|
|
|
|
|
|
|
|
;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist
|
|
|
|
|
:i "C-e" 'narf/move-to-eol
|
|
|
|
|
:i "C-u" 'narf/backward-kill-to-bol-and-indent
|
|
|
|
|
|
|
|
|
|
;; Fixes delete
|
|
|
|
|
:i "<kp-delete>" 'delete-char
|
|
|
|
|
|
|
|
|
|
;; Fix osx keymappings and then some
|
|
|
|
|
:i "<M-left>" 'narf/move-to-bol
|
|
|
|
|
:i "<M-right>" 'narf/move-to-eol
|
|
|
|
|
:i "<M-up>" 'beginning-of-buffer
|
|
|
|
|
:i "<M-down>" 'end-of-buffer
|
|
|
|
|
:i "<C-up>" 'smart-up
|
|
|
|
|
:i "<C-down>" 'smart-down
|
|
|
|
|
|
|
|
|
|
;; Fix emacs motion keys
|
|
|
|
|
:i "A-b" 'evil-backward-word-begin
|
|
|
|
|
:i "A-w" 'evil-forward-word-begin
|
|
|
|
|
:i "A-e" 'evil-forward-word-end
|
|
|
|
|
|
|
|
|
|
;; Textmate-esque insert-line before/after
|
2015-06-20 10:23:34 +02:00
|
|
|
|
:i "<M-return>" 'evil-open-below
|
|
|
|
|
:i "<S-M-return>" 'evil-open-above
|
|
|
|
|
;; insert lines in-place)
|
|
|
|
|
:n "<M-return>" (λ (save-excursion (evil-insert-newline-below)))
|
|
|
|
|
:n "<S-M-return>" (λ (save-excursion (evil-insert-newline-above)))
|
2015-06-15 09:10:28 +02:00
|
|
|
|
|
|
|
|
|
;; Make ESC quit all the things
|
|
|
|
|
:e [escape] 'narf-minibuffer-quit
|
|
|
|
|
(:map (minibuffer-local-map
|
|
|
|
|
minibuffer-local-ns-map
|
|
|
|
|
minibuffer-local-completion-map
|
|
|
|
|
minibuffer-local-must-match-map
|
|
|
|
|
minibuffer-local-isearch-map)
|
|
|
|
|
[escape] 'narf-minibuffer-quit)
|
|
|
|
|
|
2015-11-17 02:13:57 -05:00
|
|
|
|
:map read-expression-map "C-w" 'backward-kill-word)
|
2015-06-15 09:10:28 +02:00
|
|
|
|
|
2015-10-13 00:47:40 -04:00
|
|
|
|
(bind! :i "A-o" (λ (insert "ø"))
|
2015-11-10 18:10:32 -05:00
|
|
|
|
:i "A-O" (λ (insert "Ø"))
|
|
|
|
|
|
|
|
|
|
:i "A--" (λ (insert "–"))
|
|
|
|
|
:i "A-_" (λ (insert "—")))
|
2015-10-13 00:47:40 -04:00
|
|
|
|
|
2015-06-15 09:10:28 +02:00
|
|
|
|
;; 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>"))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2015-11-21 19:36:29 -05:00
|
|
|
|
(define-key help-map "e" 'narf:popup-messages)
|
|
|
|
|
|
|
|
|
|
;; Remove slow/annoying help subsections
|
|
|
|
|
(define-key help-map "h" nil)
|
|
|
|
|
(define-key help-map "g" nil)
|
|
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
|
(provide 'my-bindings)
|
|
|
|
|
;;; my-bindings.el ends here
|