From d0e84e3d4171227aa7c85a8f201b63446693b74d Mon Sep 17 00:00:00 2001 From: Benjamin Andresen Date: Fri, 21 Jul 2017 16:48:34 +0200 Subject: [PATCH 1/4] Fix: tools/eshell: set prompt-regexp to what eshell expects eshell-prompt-regexp has to be in sync with eshell-prompt-function otherwise certain eshell behavior will not work properly For example: eshell-bol --- modules/tools/eshell/config.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/tools/eshell/config.el b/modules/tools/eshell/config.el index 9bd0362f0..22adcfdfb 100644 --- a/modules/tools/eshell/config.el +++ b/modules/tools/eshell/config.el @@ -18,6 +18,7 @@ eshell-buffer-shorthand t eshell-kill-processes-on-exit t ;; em-prompt + eshell-prompt-regexp "^.* λ " eshell-prompt-function #'+eshell/prompt ;; em-glob eshell-glob-case-insensitive t @@ -50,6 +51,7 @@ redefines its keys every time `eshell-mode' is enabled." :i "" #'eshell-pcomplete :i "C-u" #'eshell-kill-input :i "SPC" #'self-insert-command + :i "C-a" #'eshell-bol :m "" #'+eshell/evil-append :n [remap evil-window-split] #'+eshell/split :n [remap evil-window-vsplit] #'+eshell/vsplit From 22c9e2350d8edab32f016a03f4543425a2a37983 Mon Sep 17 00:00:00 2001 From: Benjamin Andresen Date: Fri, 21 Jul 2017 16:50:44 +0200 Subject: [PATCH 2/4] Add: tools/eshell: C-d now quits or deletes depending on state this is the default behavior of bash, zsh et al. --- modules/tools/eshell/autoload/eshell.el | 7 +++++++ modules/tools/eshell/config.el | 1 + 2 files changed, 8 insertions(+) diff --git a/modules/tools/eshell/autoload/eshell.el b/modules/tools/eshell/autoload/eshell.el index de3202718..c65d95215 100644 --- a/modules/tools/eshell/autoload/eshell.el +++ b/modules/tools/eshell/autoload/eshell.el @@ -35,6 +35,13 @@ module to be loaded." (+eshell/run)) (doom/workspace-display)) +;;;###autoload +(defun +eshell/quit-or-delete-char (arg) + (interactive "p") + (if (and (eolp) (looking-back eshell-prompt-regexp)) + (eshell-life-is-too-much) + (delete-forward-char arg))) + (defun +eshell--outside-prompt-p () (< (point) eshell-last-output-end)) diff --git a/modules/tools/eshell/config.el b/modules/tools/eshell/config.el index 22adcfdfb..ec6cc56bb 100644 --- a/modules/tools/eshell/config.el +++ b/modules/tools/eshell/config.el @@ -52,6 +52,7 @@ redefines its keys every time `eshell-mode' is enabled." :i "C-u" #'eshell-kill-input :i "SPC" #'self-insert-command :i "C-a" #'eshell-bol + :i "C-d" #'+eshell/quit-or-delete-char :m "" #'+eshell/evil-append :n [remap evil-window-split] #'+eshell/split :n [remap evil-window-vsplit] #'+eshell/vsplit From 279cea5b08da2c859af769bba9e2aa850de98b7b Mon Sep 17 00:00:00 2001 From: Benjamin Andresen Date: Fri, 21 Jul 2017 17:07:17 +0200 Subject: [PATCH 3/4] Add: tools/eshell: additional familiar readline bindings --- modules/tools/eshell/config.el | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/modules/tools/eshell/config.el b/modules/tools/eshell/config.el index ec6cc56bb..c999c4996 100644 --- a/modules/tools/eshell/config.el +++ b/modules/tools/eshell/config.el @@ -40,19 +40,24 @@ "Setup eshell keybindings. This must be done in a hook because eshell redefines its keys every time `eshell-mode' is enabled." (map! :map eshell-mode-map - :n "i" #'+eshell/evil-prepend-maybe - :n "I" #'+eshell/evil-prepend - :n "a" #'+eshell/evil-append-maybe - :n "A" #'+eshell/evil-append - :n "r" #'+eshell/evil-replace-maybe - :n "R" #'+eshell/evil-replace-state-maybe - :n "c" #'+eshell/evil-change - :n "C" #'+eshell/evil-change-line - :i "" #'eshell-pcomplete - :i "C-u" #'eshell-kill-input - :i "SPC" #'self-insert-command - :i "C-a" #'eshell-bol - :i "C-d" #'+eshell/quit-or-delete-char + :n "i" #'+eshell/evil-prepend-maybe + :n "I" #'+eshell/evil-prepend + :n "a" #'+eshell/evil-append-maybe + :n "A" #'+eshell/evil-append + :n "r" #'+eshell/evil-replace-maybe + :n "R" #'+eshell/evil-replace-state-maybe + :n "c" #'+eshell/evil-change + :n "C" #'+eshell/evil-change-line + :i "" #'eshell-pcomplete + :i "C-u" #'eshell-kill-input + :i "SPC" #'self-insert-command + :i "C-a" #'eshell-bol + :i "C-d" #'+eshell/quit-or-delete-char + :i "C-k" #'kill-line + :i "C-p" #'eshell-previous-input + :i "" #'eshell-previous-input + :i "C-n" #'eshell-previous-input + :i "" #'eshell-previous-input :m "" #'+eshell/evil-append :n [remap evil-window-split] #'+eshell/split :n [remap evil-window-vsplit] #'+eshell/vsplit From ce50ddd563758bd39a7f9e48b1fd96e2cd2047ec Mon Sep 17 00:00:00 2001 From: Benjamin Andresen Date: Sat, 22 Jul 2017 00:12:04 +0200 Subject: [PATCH 4/4] Fix: tools/eshell: get rid of compile warnings in quit-or-delete-char --- modules/tools/eshell/autoload/eshell.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tools/eshell/autoload/eshell.el b/modules/tools/eshell/autoload/eshell.el index c65d95215..33d219037 100644 --- a/modules/tools/eshell/autoload/eshell.el +++ b/modules/tools/eshell/autoload/eshell.el @@ -38,9 +38,9 @@ module to be loaded." ;;;###autoload (defun +eshell/quit-or-delete-char (arg) (interactive "p") - (if (and (eolp) (looking-back eshell-prompt-regexp)) + (if (and (eolp) (looking-back eshell-prompt-regexp nil)) (eshell-life-is-too-much) - (delete-forward-char arg))) + (delete-char arg))) (defun +eshell--outside-prompt-p () (< (point) eshell-last-output-end))