(use-package vterm :commands vterm :init (defun project-vterm () (interactive) (if (projectile-project-root) (call-interactively #'projectile-run-vterm) (call-interactively #'vterm))) :config (evil-collection-vterm-setup) ;; Add a hook when vterm changes the directory (defvar vterm-directory-change-hook nil "Hooks to be run after vterm changes the directory") (defun vterm--set-directory (path) "Set `default-directory' to PATH." (let ((dir (vterm--get-directory path))) (when dir (setq default-directory dir) (run-hooks 'vterm-directory-change-hook)))) (add-hook 'vterm-mode-hook #'hack-dir-local-variables-non-file-buffer) (add-hook 'vterm-directory-change-hook #'hack-dir-local-variables-non-file-buffer) :general (leader-map "v" #'project-vterm) :custom (vterm-environment '("TYPEWRITTEN_CURSOR=terminal")) (vterm-ignore-blink-cursor t)) (provide 'init-vterm)