我的init.el
中有以下代码
;;open eshell
(defun eshell-other-window ()
(interactive)
(let ((buf (eshell)))
(switch-to-buffer (other-buffer buf))
(switch-to-buffer-other-window buf)
)
)
(global-set-key (kbd "C-t") 'eshell-other-window)
这很好,直到我退出eshell。当我退出时,窗户保持打开状态。如何使窗口自动关闭?
答案 0 :(得分:2)
以下答案假定用户在命令提示符下的exit
缓冲区中键入*Eshell*
,然后按回车/确认键,并且答案假定函数eshell/exit
为做它的事情。 [用户仍然可以自定义变量eshell-kill-on-exit
,以退出时埋入或杀死*Eshell*
缓冲区。]
(require 'eshell)
(defun my-custom-func ()
(when (not (one-window-p))
(delete-window)))
(advice-add 'eshell-life-is-too-much :after 'my-custom-func)