From e70b1af49fd61001e1d805406b8abeec0094dfd4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 26 May 2018 19:13:15 +0200 Subject: [PATCH] Bind RET to +eshell/goto-end-of-prompt from normal mode This command enters insert state. --- modules/tools/eshell/autoload/evil.el | 8 ++++++++ modules/tools/eshell/config.el | 1 + 2 files changed, 9 insertions(+) diff --git a/modules/tools/eshell/autoload/evil.el b/modules/tools/eshell/autoload/evil.el index 60c1c52d3..e331d9d51 100644 --- a/modules/tools/eshell/autoload/evil.el +++ b/modules/tools/eshell/autoload/evil.el @@ -11,6 +11,14 @@ already there)." (point-max) eshell-last-output-end)))) +;;;###autoload +(defun +eshell/goto-end-of-prompt () + "Move cursor to the prompt when switching to insert mode (if point isn't +already there)." + (interactive) + (goto-char (point-max)) + (evil-append 1)) + ;;;###autoload (autoload '+eshell:run "tools/eshell/autoload/evil" nil t) (evil-define-command +eshell:run (command bang) ;; TODO Add COMMAND support diff --git a/modules/tools/eshell/config.el b/modules/tools/eshell/config.el index 73ee8cdac..45e16e9f2 100644 --- a/modules/tools/eshell/config.el +++ b/modules/tools/eshell/config.el @@ -56,6 +56,7 @@ "Setup eshell keybindings. This must be done in a hook because eshell-mode redefines its keys every time `eshell-mode' is enabled." (map! :map eshell-mode-map + :n [return] #'+eshell/goto-end-of-prompt :n "c" #'+eshell/evil-change :n "C" #'+eshell/evil-change-line :n "d" #'+eshell/evil-delete