From 22c9e2350d8edab32f016a03f4543425a2a37983 Mon Sep 17 00:00:00 2001 From: Benjamin Andresen Date: Fri, 21 Jul 2017 16:50:44 +0200 Subject: [PATCH] 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