diff options
author | Case Duckworth | 2021-05-19 12:40:09 -0500 |
---|---|---|
committer | Case Duckworth | 2021-05-19 12:40:35 -0500 |
commit | 33632cc2838a20b8c77b73faa99654d31e6e21ed (patch) | |
tree | 6a306a4201a48c7b05099ea3b26ad2a0386b3be3 | |
parent | Start flyspell automatically at home (diff) | |
download | emacs-33632cc2838a20b8c77b73faa99654d31e6e21ed.tar.gz emacs-33632cc2838a20b8c77b73faa99654d31e6e21ed.zip |
Add `eshell-pop-or-quit' for easier keybinding
-rw-r--r-- | init.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/init.el b/init.el index 09a864f..6628b29 100644 --- a/init.el +++ b/init.el | |||
@@ -260,7 +260,8 @@ | |||
260 | 260 | ||
261 | (setup eshell | 261 | (setup eshell |
262 | (:option eshell-directory-name (acdw/dir "eshell/" t) | 262 | (:option eshell-directory-name (acdw/dir "eshell/" t) |
263 | eshell-aliases-file (acdw/dir "eshell/aliases" t)) | 263 | eshell-aliases-file (acdw/dir "eshell/aliases" t) |
264 | eshell-kill-on-exit nil) | ||
264 | 265 | ||
265 | (defun eshell-quit-or-delete-char (arg) | 266 | (defun eshell-quit-or-delete-char (arg) |
266 | "Delete the character to the right, or quit eshell on an empty line." | 267 | "Delete the character to the right, or quit eshell on an empty line." |
@@ -269,10 +270,16 @@ | |||
269 | (eshell-life-is-too-much) | 270 | (eshell-life-is-too-much) |
270 | (delete-forward-char arg))) | 271 | (delete-forward-char arg))) |
271 | 272 | ||
272 | (global-set-key (kbd "<f12>") #'eshell) | 273 | (defun eshell-pop-or-quit (&optional buffer-name) |
274 | "Pop open an eshell buffer, or if in an eshell buffer, bury it." | ||
275 | (interactive) | ||
276 | (if (eq (current-buffer) (get-buffer (or buffer-name "*eshell*"))) | ||
277 | (eshell-life-is-too-much) | ||
278 | (eshell))) | ||
279 | |||
280 | (:leader "s" eshell-pop-or-quit) | ||
273 | 281 | ||
274 | (hook-defun eshell-setup 'eshell-mode-hook | 282 | (hook-defun eshell-setup 'eshell-mode-hook |
275 | (define-key eshell-mode-map (kbd "<f12>") #'bury-buffer) | ||
276 | (define-key eshell-mode-map (kbd "C-d") #'eshell-quit-or-delete-char) | 283 | (define-key eshell-mode-map (kbd "C-d") #'eshell-quit-or-delete-char) |
277 | (when (boundp 'simple-modeline--mode-line) | 284 | (when (boundp 'simple-modeline--mode-line) |
278 | (setq mode-line-format '(:eval simple-modeline--mode-line))))) | 285 | (setq mode-line-format '(:eval simple-modeline--mode-line))))) |