Rethink bindings
This commit is contained in:
parent
5c1aac9178
commit
2bffc233ec
2 changed files with 50 additions and 56 deletions
|
@ -61,6 +61,22 @@
|
||||||
((keymapp -state)
|
((keymapp -state)
|
||||||
(define-key -state -key -def)))))))))
|
(define-key -state -key -def)))))))))
|
||||||
|
|
||||||
|
(after "evil"
|
||||||
|
(evil-define-command my--maybe-exit-insert-mode ()
|
||||||
|
"Exits insert mode using jk without the momentary pause caused by
|
||||||
|
key-chord-define."
|
||||||
|
:repeat change
|
||||||
|
(interactive)
|
||||||
|
(let ((modified (buffer-modified-p)))
|
||||||
|
(insert "j")
|
||||||
|
(let ((evt (read-event nil nil 0.4)))
|
||||||
|
(cond
|
||||||
|
((null evt) (message ""))
|
||||||
|
((and (integerp evt) (char-equal evt ?k))
|
||||||
|
(delete-char -1)
|
||||||
|
(set-buffer-modified-p modified)
|
||||||
|
(push 'escape unread-command-events))
|
||||||
|
(t (setq unread-command-events (append unread-command-events (list evt)))))))))
|
||||||
|
|
||||||
;; Hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; Hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defun enable-comment-hard-wrap ()
|
(defun enable-comment-hard-wrap ()
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
(bind (kbd "M-x") 'smex
|
(bind (kbd "M-x") 'smex
|
||||||
(kbd "M-X") 'smex-major-mode-commands
|
(kbd "M-X") 'smex-major-mode-commands
|
||||||
(kbd "C-;") 'eval-expression
|
(kbd "C-;") 'eval-expression
|
||||||
;; (kbd "C-`") 'popwin:toggle-eshell-window
|
(kbd "C-`") 'popwin:toggle-popup-window
|
||||||
(kbd "C-~") 'popwin:toggle-popup-window
|
|
||||||
|
|
||||||
(kbd "s-=") 'text-scale-increase
|
(kbd "s-=") 'text-scale-increase
|
||||||
(kbd "s--") 'text-scale-decrease
|
(kbd "s--") 'text-scale-decrease
|
||||||
|
@ -16,22 +15,11 @@
|
||||||
(kbd "s-/") 'evilnc-comment-or-uncomment-lines)
|
(kbd "s-/") 'evilnc-comment-or-uncomment-lines)
|
||||||
|
|
||||||
;; Faster scrolling
|
;; Faster scrolling
|
||||||
(bind '(normal visual) my-mode-map
|
(bind 'motion my-mode-map
|
||||||
(kbd "s-j") "6j"
|
(kbd "s-j") "6j"
|
||||||
(kbd "s-k") "6k"
|
(kbd "s-k") "6k")
|
||||||
(kbd "s-b") 'my:build
|
|
||||||
(kbd "s-f") 'helm-swoop
|
|
||||||
(kbd "s-F") 'helm-do-ag)
|
|
||||||
|
|
||||||
(bind 'normal my-mode-map
|
(bind 'normal my-mode-map
|
||||||
(kbd "s-r") 'my-run-code-buffer
|
|
||||||
(kbd "s-R") 'my-switch-to-repl
|
|
||||||
(kbd "s-t") 'helm-projectile-find-file
|
|
||||||
(kbd "s-T") 'helm-semantic-or-imenu
|
|
||||||
(kbd "s-p") 'helm-projectile-switch-project
|
|
||||||
(kbd "s-P") 'persp-switch
|
|
||||||
(kbd "s-m") ",m"
|
|
||||||
(kbd "s-M") ",M"
|
|
||||||
(kbd "s-o") 'ido-find-file
|
(kbd "s-o") 'ido-find-file
|
||||||
(kbd "s-d") 'dash-at-point)
|
(kbd "s-d") 'dash-at-point)
|
||||||
|
|
||||||
|
@ -46,7 +34,7 @@
|
||||||
|
|
||||||
(bind '(normal visual) my-mode-map
|
(bind '(normal visual) my-mode-map
|
||||||
"\\" 'evil-execute-in-god-state ; localleader
|
"\\" 'evil-execute-in-god-state ; localleader
|
||||||
;; ";" 'evil-ex ; Remap ; to : - SPC and shift-SPC replace ; and ,
|
";" 'evil-ex
|
||||||
"X" 'evil-exchange
|
"X" 'evil-exchange
|
||||||
|
|
||||||
"g SPC" (λ (call-interactively
|
"g SPC" (λ (call-interactively
|
||||||
|
@ -83,30 +71,10 @@
|
||||||
", <" 'helm-mini
|
", <" 'helm-mini
|
||||||
", ]" 'helm-etags-select
|
", ]" 'helm-etags-select
|
||||||
", /" 'helm-projectile-find-file
|
", /" 'helm-projectile-find-file
|
||||||
", ." 'helm-resume)
|
", ." 'helm-resume
|
||||||
|
|
||||||
(bind 'god my-mode-map
|
|
||||||
;; <localleader>
|
|
||||||
"\\" 'neotree-toggle
|
|
||||||
":" 'linum-mode
|
|
||||||
"=" 'toggle-transparency
|
|
||||||
|
|
||||||
"]" 'next-buffer
|
|
||||||
"[" 'previous-buffer
|
|
||||||
|
|
||||||
"o f" 'my-send-dir-to-finder
|
|
||||||
"o u" 'my-send-to-transmit
|
|
||||||
"o l" 'my-send-to-launchbar
|
|
||||||
"o L" 'my-send-dir-to-launchbar
|
|
||||||
|
|
||||||
;; tmux: cd (default-directory)
|
|
||||||
"o t" (λ (my:tmux-chdir nil t))
|
|
||||||
;; tmux: cd [project root]
|
|
||||||
"o T" 'my:tmux-chdir)
|
|
||||||
|
|
||||||
(bind 'normal my-mode-map
|
|
||||||
;; behave like D and C; yank to end of line
|
;; behave like D and C; yank to end of line
|
||||||
"Y" (λ (evil-yank (point) (point-at-eol)))
|
"Y" (λ (evil-yank (point) (point-at-eol)))
|
||||||
|
|
||||||
"z x" 'kill-this-buffer
|
"z x" 'kill-this-buffer
|
||||||
"Z X" 'bury-buffer
|
"Z X" 'bury-buffer
|
||||||
|
@ -137,6 +105,28 @@
|
||||||
(evil-normal-state)
|
(evil-normal-state)
|
||||||
(evil-visual-restore)))
|
(evil-visual-restore)))
|
||||||
|
|
||||||
|
(bind 'god my-mode-map
|
||||||
|
;; <localleader>
|
||||||
|
"\\" 'neotree-toggle
|
||||||
|
":" 'linum-mode
|
||||||
|
"=" 'toggle-transparency
|
||||||
|
"e" 'evil-emacs-state
|
||||||
|
|
||||||
|
"]" 'next-buffer
|
||||||
|
"[" 'previous-buffer
|
||||||
|
|
||||||
|
"o f" 'my-send-dir-to-finder
|
||||||
|
"o u" 'my-send-to-transmit
|
||||||
|
"o l" 'my-send-to-launchbar
|
||||||
|
"o L" 'my-send-dir-to-launchbar
|
||||||
|
|
||||||
|
;; tmux: cd (default-directory)
|
||||||
|
"o t" (λ (my:tmux-chdir nil t))
|
||||||
|
;; tmux: cd [project root]
|
||||||
|
"o T" 'my:tmux-chdir)
|
||||||
|
|
||||||
|
(bind 'emacs [escape] 'evil-normal-state)
|
||||||
|
|
||||||
(bind 'insert my-mode-map
|
(bind 'insert my-mode-map
|
||||||
"<M-kp-delete>" (λ (evil-forward-word) (evil-delete-backward-word))
|
"<M-kp-delete>" (λ (evil-forward-word) (evil-delete-backward-word))
|
||||||
|
|
||||||
|
@ -151,30 +141,18 @@
|
||||||
"s-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
|
"s-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
|
||||||
"<backtab>" (kbd "s-["))
|
"<backtab>" (kbd "s-["))
|
||||||
|
|
||||||
;; (bind 'emacs
|
;; Enable TAB to do matchit
|
||||||
;; ;; Preserve buffer-movement in emacs mode
|
(bind '(normal visual) evil-matchit-mode-map [tab] 'evilmi-jump-items)
|
||||||
;; "C-j" 'evil-next-line
|
|
||||||
;; "C-k" 'evil-previous-line
|
|
||||||
|
|
||||||
;; "C-w h" 'evil-window-left
|
|
||||||
;; "C-w l" 'evil-window-right
|
|
||||||
;; "C-w j" 'evil-window-down
|
|
||||||
;; "C-w k" 'evil-window-up)
|
|
||||||
|
|
||||||
;; Rotate-text (see elisp/rotate-text.el)
|
;; Rotate-text (see elisp/rotate-text.el)
|
||||||
(bind 'normal my-mode-map "!" 'rotate-word-at-point)
|
(bind 'normal my-mode-map "!" 'rotate-word-at-point)
|
||||||
(bind 'visual my-mode-map "!" 'rotate-region)
|
(bind 'visual my-mode-map "!" 'rotate-region)
|
||||||
|
|
||||||
;; Easy escape from insert mode
|
|
||||||
;; (ibind "jk" 'evil-normal-state)
|
|
||||||
|
|
||||||
;; Enable TAB to do matchit
|
|
||||||
(bind '(normal visual) evil-matchit-mode-map [tab] 'evilmi-jump-items)
|
|
||||||
|
|
||||||
;; Additional operators
|
;; Additional operators
|
||||||
(bind 'normal my-mode-map "g r" 'my:run-code) ; code eval
|
(bind 'motion my-mode-map "g x" 'my-scratch-buffer) ; send to scratch buffer
|
||||||
(bind 'normal my-mode-map "g R" 'my:send-region-to-repl) ; eval in repl
|
|
||||||
(bind 'normal my-mode-map "g x" 'my-scratch-buffer) ; send to scratch buffer
|
;; Easy escape from insert mode (more responsive than using key-chord-define)
|
||||||
|
(bind 'insert "j" #'my--maybe-exit-insert-mode)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue