dotfiles/emacs/.emacs.d/config/init-vterm.el

29 lines
953 B
EmacsLisp
Raw Normal View History

2021-02-21 13:20:05 +00:00
(use-package vterm
:commands vterm
:init
(defun project-vterm ()
(interactive)
(if (projectile-project-root)
(call-interactively #'projectile-run-vterm)
(call-interactively #'vterm)))
2021-02-21 21:09:28 +00:00
:config
(evil-collection-vterm-setup)
2021-02-22 14:43:04 +00:00
;; 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)
2021-02-21 13:20:05 +00:00
:general
2021-02-21 21:09:28 +00:00
(leader-map "v" #'project-vterm)
:custom
(vterm-environment '("TYPEWRITTEN_CURSOR=terminal"))
(vterm-ignore-blink-cursor t))
2021-02-21 13:20:05 +00:00
(provide 'init-vterm)