Add `eshell-pop-or-quit' for easier keybinding

This commit is contained in:
Case Duckworth 2021-05-19 12:40:09 -05:00
parent 14f6bc67ff
commit 33632cc283
1 changed files with 10 additions and 3 deletions

13
init.el
View File

@ -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 "<f12>") #'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 "<f12>") #'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)))))