 ;;; 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
 (defun +vterm/toggle (arg)

          (when (bound-and-true-p evil-local-mode)
            (evil-change-to-initial-state))
          (goto-char (point-max)))
      (setenv "PROOT" (or (doom-project-root) default-directory))
      (vterm-other-window buffer-name))))

;;;###autoload
(defun +vterm/here (arg)

  (let ((default-directory
          (if arg
              default-directory
            (or (doom-project-root) default-directory))))
    (+vterm--get-create-buffer buffer-name)))


(defvar +vterm--insert-point nil)
