Add `eshell-pop-or-quit' for easier keybinding
This commit is contained in:
parent
14f6bc67ff
commit
33632cc283
13
init.el
13
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 "<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)))))
|
||||
|
|
Loading…
Reference in New Issue