mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Fix +vterm/* commands spawning new buffer each time
This commit is contained in:
@ -1,5 +1,12 @@
|
|||||||
;;; term/vterm/autoload.el -*- lexical-binding: t; -*-
|
;;; term/vterm/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defun +vterm--get-create-buffer (buffer-name)
|
||||||
|
(setenv "PROOT" (or (doom-project-root) default-directory))
|
||||||
|
(let ((buffer (get-buffer-create buffer-name)))
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(vterm-mode))
|
||||||
|
(pop-to-buffer buffer)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +vterm/toggle (arg)
|
(defun +vterm/toggle (arg)
|
||||||
"Toggles a terminal popup window at project root.
|
"Toggles a terminal popup window at project root.
|
||||||
@ -29,8 +36,7 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
|
|||||||
(when (bound-and-true-p evil-local-mode)
|
(when (bound-and-true-p evil-local-mode)
|
||||||
(evil-change-to-initial-state))
|
(evil-change-to-initial-state))
|
||||||
(goto-char (point-max)))
|
(goto-char (point-max)))
|
||||||
(setenv "PROOT" (or (doom-project-root) default-directory))
|
(+vterm--get-create-buffer buffer-name))))
|
||||||
(vterm-other-window buffer-name))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +vterm/here (arg)
|
(defun +vterm/here (arg)
|
||||||
@ -47,9 +53,8 @@ If prefix ARG is non-nil, cd into `default-directory' instead of project root."
|
|||||||
(let ((default-directory
|
(let ((default-directory
|
||||||
(if arg
|
(if arg
|
||||||
default-directory
|
default-directory
|
||||||
(or (doom-project-root) default-directory)))
|
(or (doom-project-root) default-directory))))
|
||||||
display-buffer-alist)
|
(+vterm--get-create-buffer buffer-name)))
|
||||||
(vterm)))
|
|
||||||
|
|
||||||
|
|
||||||
(defvar +vterm--insert-point nil)
|
(defvar +vterm--insert-point nil)
|
||||||
|
Reference in New Issue
Block a user