term/eshell: refactor & update keybinds

- Replace +eshell|init-evil with an advice for
  evil-collection-eshell-next-prompt-on-insert
- Update C-n/C-j and C-p/C-k keybinds to use
  eshell-{next,previous}-matching-input-from-input, which behave much
  like zsh's history-substring-search-{up,down}
- Move window navigation keybinds C-{h,j,k,l} to C-c {h,j,k,l} (more
  tmux-esque).
This commit is contained in:
Henrik Lissner 2019-06-11 07:57:26 +02:00
parent 4fec3eb698
commit a56ce38903
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 25 additions and 28 deletions

View file

@ -1,15 +1,6 @@
;;; term/eshell/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil)
;;;###autoload
(defun +eshell|init-evil ()
"Replace `evil-collection-eshell-next-prompt-on-insert' with
`+eshell|goto-prompt-on-insert', which ensures the point is on the prompt when
changing to insert mode."
(dolist (hook '(evil-replace-state-entry-hook evil-insert-state-entry-hook))
(remove-hook hook 'evil-collection-eshell-next-prompt-on-insert t)
(add-hook hook '+eshell|goto-prompt-on-insert nil t)))
;;;###autoload (autoload '+eshell:run "term/eshell/autoload/evil" nil t)
(evil-define-command +eshell:run (command bang)
"TODO"
@ -23,9 +14,11 @@ changing to insert mode."
((+eshell/open-popup nil command)))))
;;;###autoload
(defun +eshell|goto-prompt-on-insert ()
(defun +eshell*goto-prompt-on-insert ()
"Move cursor to the prompt when switching to insert mode (if point isn't
already there)."
already there).
Meant to replace `evil-collection-eshell-next-prompt-on-insert'."
(when (< (point) eshell-last-output-end)
(goto-char
(if (memq this-command '(evil-append evil-append-line))