I'm not enough of an emacs expert to know if this is PR-ready, but I here's my solution if anyone's interested:
(use-package vterm
:ensure t
:config
(with-eval-after-load 'project
(add-to-list 'project-switch-commands '(vterm-project "vterm" "t") t)
(keymap-set project-prefix-map "t" #'vterm-project)))
(defun vterm-project ()
(interactive)
(defvar vterm-buffer-name)
(let* ((default-directory (project-root (project-current t)))
(vterm-buffer-name (project-prefixed-buffer-name "vterm"))
(vterm-buffer (get-buffer vterm-buffer-name)))
(if (and vterm-buffer (not current-prefix-arg))
(pop-to-buffer vterm-buffer (bound-and-true-p display-comint-buffer-action))
(vterm-other-window t))))
The vterm-project function is literally copied over from the project-eshell function with changed names.
I'm not enough of an emacs expert to know if this is PR-ready, but I here's my solution if anyone's interested:
The
vterm-projectfunction is literally copied over from theproject-eshellfunction with changed names.