From 33632cc2838a20b8c77b73faa99654d31e6e21ed Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 19 May 2021 12:40:09 -0500 Subject: Add `eshell-pop-or-quit' for easier keybinding --- init.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 09a864f..6628b29 100644 --- a/init.el +++ b/init.el @@ -260,7 +260,8 @@ (setup eshell (:option eshell-directory-name (acdw/dir "eshell/" t) - eshell-aliases-file (acdw/dir "eshell/aliases" t)) + eshell-aliases-file (acdw/dir "eshell/aliases" t) + eshell-kill-on-exit nil) (defun eshell-quit-or-delete-char (arg) "Delete the character to the right, or quit eshell on an empty line." @@ -269,10 +270,16 @@ (eshell-life-is-too-much) (delete-forward-char arg))) - (global-set-key (kbd "") #'eshell) + (defun eshell-pop-or-quit (&optional buffer-name) + "Pop open an eshell buffer, or if in an eshell buffer, bury it." + (interactive) + (if (eq (current-buffer) (get-buffer (or buffer-name "*eshell*"))) + (eshell-life-is-too-much) + (eshell))) + + (:leader "s" eshell-pop-or-quit) (hook-defun eshell-setup 'eshell-mode-hook - (define-key eshell-mode-map (kbd "") #'bury-buffer) (define-key eshell-mode-map (kbd "C-d") #'eshell-quit-or-delete-char) (when (boundp 'simple-modeline--mode-line) (setq mode-line-format '(:eval simple-modeline--mode-line))))) -- cgit 1.4.1-21-gabe81