Context-based delete-char or close shell in eshell

This commit is contained in:
Gergely Polonkai 2016-09-27 16:33:53 +02:00
parent a91334e30f
commit 6c576d1e64
1 changed files with 16 additions and 0 deletions

16
init.el
View File

@ -520,3 +520,19 @@ Version 2016-02-16"
(setq zone-programs [zone-nyan])
(require 'zone)
(zone-when-idle 30)
; delete-char or close eshell
; Copied from https://ryuslash.org/posts/C-d-to-close-eshell.html
(defun eshell-C-d ()
"Either call `delete-char' interactively or quit."
(interactive)
(condition-case err
(call-interactively #'delete-char)
(error (if (and (eq (car err) 'end-of-buffer)
(looking-back eshell-prompt-regexp))
(kill-buffer)
(signal (car err) (cdr err))))))
(add-hook 'eshell-mode-hook
(lambda () (local-set-key (kbd "C-d") #'eshell-C-d)))