diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-external.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/init-external.el b/lisp/init-external.el index c9d39ae..be8cdcd 100644 --- a/lisp/init-external.el +++ b/lisp/init-external.el @@ -20,9 +20,17 @@ other window when an asynchronous command is run." (define-prefix-command 'external-map) (global-set-key (kbd "C-c x") 'external-map) -(defun km/zsh-ansi-term () - (interactive) - (ansi-term "/bin/zsh")) +(defun km/zsh-ansi-term (&optional new-buffer) + "Open an ansi-term buffer running ZSH. +The buffer is named according to `default-directory'. If a buffer +of the same name already exists, switch to it unless NEW-BUFFER +is non-nil, switch to the buffer." + (interactive "P") + (let ((name (concat "zsh:" (abbreviate-file-name default-directory)))) + (-if-let (buffer-name (and (not new-buffer) + (get-buffer (concat "*" name "*")))) + (switch-to-buffer buffer-name) + (ansi-term "/bin/zsh" name)))) (defun km/display-compilation-other-window () (interactive) |