term/eshell: remove redundant keys (with evil-collection)

And expand comments + use windmove-* instead of evil-window-* so as to
not exclude non-evil users from these keybinds.
This commit is contained in:
Henrik Lissner 2019-07-22 00:24:06 +02:00
parent 448ec65997
commit 1b79aa1b4d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -119,9 +119,11 @@ You should use `set-eshell-alias!' to change this.")
(when (featurep! :editor evil +everywhere) (when (featurep! :editor evil +everywhere)
(advice-add #'evil-collection-eshell-next-prompt-on-insert :override #'+eshell*goto-prompt-on-insert)) (advice-add #'evil-collection-eshell-next-prompt-on-insert :override #'+eshell*goto-prompt-on-insert))
(defun +eshell|init-keymap () (add-hook 'eshell-first-time-mode-hook
"Setup eshell keybindings. This must be done in a hook because eshell-mode (defun +eshell-init-keymap-h ()
redefines its keys every time `eshell-mode' is enabled." ;; Keys must be bound in a hook because eshell resets its keymap every
;; time `eshell-mode' is enabled. Why? It is not for us mere mortals to
;; grasp such wisdom.
(map! :map eshell-mode-map (map! :map eshell-mode-map
:n "RET" #'+eshell/goto-end-of-prompt :n "RET" #'+eshell/goto-end-of-prompt
:n [return] #'+eshell/goto-end-of-prompt :n [return] #'+eshell/goto-end-of-prompt
@ -132,26 +134,21 @@ redefines its keys every time `eshell-mode' is enabled."
:i "TAB" #'+eshell/pcomplete :i "TAB" #'+eshell/pcomplete
:i [tab] #'+eshell/pcomplete :i [tab] #'+eshell/pcomplete
:i "C-d" #'+eshell/quit-or-delete-char :i "C-d" #'+eshell/quit-or-delete-char
:i "C-p" #'eshell-previous-matching-input-from-input
:i "C-k" #'eshell-previous-matching-input-from-input
:i "C-j" #'eshell-next-matching-input-from-input
:i "C-n" #'eshell-next-matching-input-from-input
"C-s" #'+eshell/search-history "C-s" #'+eshell/search-history
;; Tmux-esque prefix keybinds ;; Tmux-esque prefix keybinds
"C-c s" #'+eshell/split-below "C-c s" #'+eshell/split-below
"C-c v" #'+eshell/split-right "C-c v" #'+eshell/split-right
"C-c x" #'+eshell/kill-and-close "C-c x" #'+eshell/kill-and-close
"C-c h" #'evil-window-left "C-c h" #'windmove-left
"C-c j" #'evil-window-down "C-c j" #'windmove-down
"C-c k" #'evil-window-up "C-c k" #'windmove-up
"C-c l" #'evil-window-right "C-c l" #'windmove-right
[remap split-window-below] #'+eshell/split-below [remap split-window-below] #'+eshell/split-below
[remap split-window-right] #'+eshell/split-right [remap split-window-right] #'+eshell/split-right
[remap doom/backward-to-bol-or-indent] #'eshell-bol [remap doom/backward-to-bol-or-indent] #'eshell-bol
[remap doom/backward-kill-to-bol-and-indent] #'eshell-kill-input [remap doom/backward-kill-to-bol-and-indent] #'eshell-kill-input
[remap evil-window-split] #'+eshell/split-below [remap evil-window-split] #'+eshell/split-below
[remap evil-window-vsplit] #'+eshell/split-right)) [remap evil-window-vsplit] #'+eshell/split-right))))
(add-hook 'eshell-first-time-mode-hook #'+eshell|init-keymap))
(def-package! eshell-up (def-package! eshell-up