tools/term: refactor + better term popup support
This commit is contained in:
parent
dbceec4149
commit
4105c26b2a
3 changed files with 24 additions and 8 deletions
|
@ -396,6 +396,10 @@ the command buffer."
|
|||
(advice-add #'mu4e~temp-window :override #'doom*mu4e-popup-window))
|
||||
|
||||
|
||||
(after! multi-term
|
||||
(setq multi-term-buffer-name "doom:terminal"))
|
||||
|
||||
|
||||
(after! neotree
|
||||
;; Neotree has its own window/popup management built-in, which is difficult to
|
||||
;; police. For example, switching perspectives will cause neotree to forget it
|
||||
|
|
|
@ -1,16 +1,28 @@
|
|||
;;; tools/term/autoload.el
|
||||
|
||||
;;;###autoload
|
||||
(defun +term ()
|
||||
(interactive)
|
||||
(call-interactively 'multi-term))
|
||||
(defun +term (&optional project-root)
|
||||
"Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is
|
||||
non-nil, cd into the current project's root."
|
||||
(interactive "P")
|
||||
(let ((default-directory (if project-root (doom-project-root) default-directory)))
|
||||
(call-interactively 'multi-term)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/popup ()
|
||||
(interactive)
|
||||
(defun +term/popup (&optional project-root)
|
||||
"Open a terminal popup window. If PROJECT-ROOT (C-u) is non-nil, cd into the
|
||||
current project's root."
|
||||
(interactive "P")
|
||||
(require 'multi-term)
|
||||
(let* ((buffer (multi-term-get-buffer current-prefix-arg))
|
||||
(window (doom-popup-buffer buffer :popup t :align t :size 25 :select t :autokill t :noesc t)))
|
||||
(let* ((default-directory (if project-root (doom-project-root) default-directory))
|
||||
(buffer (multi-term-get-buffer current-prefix-arg))
|
||||
(window (doom-popup-buffer buffer)))
|
||||
(select-window window)
|
||||
(setq multi-term-buffer-list (nconc multi-term-buffer-list (list buffer)))
|
||||
(multi-term-internal)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/popup-in-project ()
|
||||
"Open a terminal popup window in the root of the current project."
|
||||
(interactive)
|
||||
(+term/popup t))
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
:commands (multi-term multi-term-next multi-term-prev)
|
||||
:config
|
||||
(setq multi-term-program (getenv "SHELL")
|
||||
multi-term-switch-after-close nil))
|
||||
multi-term-switch-after-close 'PREVIOUS))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue