forked from magnars/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-shell.el
33 lines (24 loc) · 875 Bytes
/
setup-shell.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
;; Setup shell
;; Note: Emacs runs .bashrc in *shell*
;; So mac users should ln -s .profile .bashrc
;; bash-completion
(autoload 'bash-completion-dynamic-complete
"bash-completion"
"BASH completion hook")
(add-hook 'shell-dynamic-complete-functions
'bash-completion-dynamic-complete)
(add-hook 'shell-command-complete-functions
'bash-completion-dynamic-complete)
;; tab-completion for shell-command
(require 'shell-command)
(shell-command-completion-mode)
;; C-d to kill buffer if process is dead.
(defun 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") 'comint-delchar-or-eof-or-kill-buffer)))
(provide 'setup-shell)