diff options
Diffstat (limited to 'init-eshell.el')
-rw-r--r-- | init-eshell.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/init-eshell.el b/init-eshell.el index da42443..d87d0e7 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -49,3 +49,20 @@ ;; use cat as the pager in shell mode, because shell-mode is not an ANSI terminal (setenv "PAGER" "cat") + +;; C-d on an empty line in the shell terminates the process. +(defun my/comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) + +(add-hook 'shell-mode-hook + (lambda () + (define-key shell-mode-map + (kbd "C-d") 'my/comint-delchar-or-eof-or-kill-buffer))) +;; TODO: this isn't working +(add-hook 'term-mode-hook + (lambda () + (define-key term-mode-map + (kbd "C-d") 'my/comint-delchar-or-eof-or-kill-buffer))) |