mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-05 12:37:33 -05:00
Move eshell, term & vterm modules to :term
This commit is contained in:
33
modules/term/term/autoload.el
Normal file
33
modules/term/term/autoload.el
Normal file
@ -0,0 +1,33 @@
|
||||
;;; term/term/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/open (arg)
|
||||
"Open a terminal buffer in the current window. If ARG (universal argument) is
|
||||
non-nil, cd into the current project's root."
|
||||
(interactive "P")
|
||||
(let ((default-directory
|
||||
(if arg
|
||||
(or (doom-project-root) default-directory)
|
||||
default-directory)))
|
||||
;; Doom's switch-buffer hooks prevent themselves from triggering when
|
||||
;; switching from buffer A back to A. Because `multi-term' uses `set-buffer'
|
||||
;; before `switch-to-buffer', the hooks don't trigger, so we use this
|
||||
;; roundabout way to trigger them properly.
|
||||
(switch-to-buffer (save-window-excursion (multi-term)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/open-popup (arg)
|
||||
"Open a terminal popup window. If ARG (universal argument) is
|
||||
non-nil, cd into the current project's root."
|
||||
(interactive "P")
|
||||
(let ((default-directory
|
||||
(if arg
|
||||
(or (doom-project-root) default-directory)
|
||||
default-directory)))
|
||||
(pop-to-buffer (save-window-excursion (multi-term)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/open-popup-in-project ()
|
||||
"Open a terminal popup window in the root of the current project."
|
||||
(interactive)
|
||||
(+term/open-popup t))
|
Reference in New Issue
Block a user