Fix +vterm-toggle not changing directory to project root

This commit is contained in:
Saúl Germán Gutiérrez Calderón 2021-05-11 16:44:29 -05:00
parent 926ba626b7
commit fe9f8e785f

View file

@ -30,12 +30,17 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
(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)) (setenv "PROOT" (or (doom-project-root) default-directory))
(let ((buffer (get-buffer-create buffer-name))) (let* ((project-root (or (doom-project-root) default-directory))
(default-directory
(if arg
default-directory
project-root)))
(let ((buffer (get-buffer-create buffer-name)))
(with-current-buffer buffer (with-current-buffer buffer
(unless (eq major-mode 'vterm-mode) (unless (eq major-mode 'vterm-mode)
(vterm-mode)) (vterm-mode))
(+vterm--change-directory-if-remote)) (+vterm--change-directory-if-remote))
(pop-to-buffer buffer))))) (pop-to-buffer buffer))))))
;;;###autoload ;;;###autoload
(defun +vterm/here (arg) (defun +vterm/here (arg)