tmux: bind named functions instead of lambdas
This commit is contained in:
parent
bd760ceebc
commit
5029734846
|
@ -32,7 +32,7 @@
|
||||||
(let
|
(let
|
||||||
((cmd (concat "windmove-" direction)))
|
((cmd (concat "windmove-" direction)))
|
||||||
(condition-case nil
|
(condition-case nil
|
||||||
(funcall (read cmd))
|
(funcall (intern cmd))
|
||||||
(error
|
(error
|
||||||
(tmux-command direction)))))
|
(tmux-command direction)))))
|
||||||
|
|
||||||
|
@ -45,71 +45,38 @@
|
||||||
(upcase
|
(upcase
|
||||||
(substring direction 0 1)))
|
(substring direction 0 1)))
|
||||||
|
|
||||||
(define-key evil-normal-state-map
|
(defun tmux-nav-left ()
|
||||||
(kbd "C-h")
|
(interactive)
|
||||||
(lambda ()
|
(tmux-navigate "left"))
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "left")))
|
|
||||||
(define-key evil-normal-state-map
|
|
||||||
(kbd "C-j")
|
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "down")))
|
|
||||||
(define-key evil-normal-state-map
|
|
||||||
(kbd "C-k")
|
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "up")))
|
|
||||||
(define-key evil-normal-state-map
|
|
||||||
(kbd "C-l")
|
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "right")))
|
|
||||||
|
|
||||||
(define-key evil-motion-state-map
|
(defun tmux-nav-right ()
|
||||||
(kbd "C-h")
|
(interactive)
|
||||||
(lambda ()
|
(tmux-navigate "right"))
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "left")))
|
(defun tmux-nav-up ()
|
||||||
(define-key evil-motion-state-map
|
(interactive)
|
||||||
(kbd "C-j")
|
(tmux-navigate "up"))
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
(defun tmux-nav-down ()
|
||||||
(tmux-navigate "down")))
|
(interactive)
|
||||||
(define-key evil-motion-state-map
|
(tmux-navigate "down"))
|
||||||
(kbd "C-k")
|
|
||||||
(lambda ()
|
(define-key evil-normal-state-map (kbd "C-h") #'tmux-nav-left)
|
||||||
(interactive)
|
(define-key evil-normal-state-map (kbd "C-j") #'tmux-nav-down)
|
||||||
(tmux-navigate "up")))
|
(define-key evil-normal-state-map (kbd "C-k") #'tmux-nav-up)
|
||||||
(define-key evil-motion-state-map
|
(define-key evil-normal-state-map (kbd "C-l") #'tmux-nav-right)
|
||||||
(kbd "C-l")
|
(define-key evil-motion-state-map (kbd "C-h") #'tmux-nav-left)
|
||||||
(lambda ()
|
(define-key evil-motion-state-map (kbd "C-j") #'tmux-nav-down)
|
||||||
(interactive)
|
(define-key evil-motion-state-map (kbd "C-k") #'tmux-nav-up)
|
||||||
(tmux-navigate "right")))
|
(define-key evil-motion-state-map (kbd "C-l") #'tmux-nav-right)
|
||||||
|
|
||||||
;; Modify `evil-evilified-state-map-original' because `evil-evilified-state-map'
|
;; Modify `evil-evilified-state-map-original' because `evil-evilified-state-map'
|
||||||
;; is reset to this value each time the evilify macro is run.
|
;; is reset to this value each time the evilify macro is run.
|
||||||
(when (boundp 'evil-evilified-state-map-original)
|
(when (boundp 'evil-evilified-state-map-original)
|
||||||
(define-key evil-evilified-state-map-original
|
(define-key evil-evilified-state-map-original (kbd "C-h") #'tmux-nav-left)
|
||||||
(kbd "C-h")
|
(define-key evil-evilified-state-map-original (kbd "C-j") #'tmux-nav-down)
|
||||||
(lambda ()
|
(define-key evil-evilified-state-map-original (kbd "C-k") #'tmux-nav-up)
|
||||||
(interactive)
|
(define-key evil-evilified-state-map-original (kbd "C-l") #'tmux-nav-right))
|
||||||
(tmux-navigate "left")))
|
|
||||||
(define-key evil-evilified-state-map-original
|
|
||||||
(kbd "C-j")
|
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "down")))
|
|
||||||
(define-key evil-evilified-state-map-original
|
|
||||||
(kbd "C-k")
|
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "up")))
|
|
||||||
(define-key evil-evilified-state-map-original
|
|
||||||
(kbd "C-l")
|
|
||||||
(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(tmux-navigate "right"))))
|
|
||||||
|
|
||||||
(provide 'tmux)
|
(provide 'tmux)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue