Open term popups in current dir, instead of project-root
CDing into the project root can be accomplished with external tools, e.g. cd $(git rev-parse --show-toplevel) cd $(hg root) cd $(npm root) Any of which could be aliased. Also, +vterm/toggle and term/toggle define the PROOT environment variable, so `cd $PROOT` will work too. On the other hand, CDing to the current file/folder requires that the shell be made aware of the file/directory of some Emacs state, which is a little trickier to deal with, so I made that the default behavior for +term/toggle, +vterm/toggle and +eshell/toggle.
This commit is contained in:
parent
2835314022
commit
9c842bfad8
3 changed files with 24 additions and 51 deletions
|
@ -8,10 +8,11 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
|
|||
(interactive "P")
|
||||
(unless (fboundp 'module-load)
|
||||
(user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm"))
|
||||
(let ((buffer-name (format "*doom:vterm-popup:%s*"
|
||||
(if (bound-and-true-p persp-mode)
|
||||
(safe-persp-name (get-current-persp))
|
||||
"main")))
|
||||
(let ((buffer-name
|
||||
(format "*doom:vterm-popup:%s*"
|
||||
(if (bound-and-true-p persp-mode)
|
||||
(safe-persp-name (get-current-persp))
|
||||
"main")))
|
||||
confirm-kill-processes
|
||||
current-prefix-arg)
|
||||
(when arg
|
||||
|
@ -29,8 +30,8 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
|
|||
(evil-change-to-initial-state))
|
||||
(goto-char (point-max)))
|
||||
(require 'vterm)
|
||||
(let* ((default-directory (or (doom-project-root) default-directory))
|
||||
(buffer (get-buffer-create buffer-name)))
|
||||
(setenv "PROOT" (or (doom-project-root) default-directory))
|
||||
(let ((buffer (get-buffer-create buffer-name)))
|
||||
(with-current-buffer buffer
|
||||
(doom|mark-buffer-as-real)
|
||||
(vterm-mode))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue