2019-05-18 23:41:18 -04:00
|
|
|
;;; term/vterm/config.el -*- lexical-binding: t; -*-
|
2019-01-27 03:45:29 +08:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! vterm
|
2020-03-27 01:25:30 -04:00
|
|
|
:when (bound-and-true-p module-file-suffix)
|
2020-04-23 16:53:37 -04:00
|
|
|
:commands vterm vterm-mode
|
|
|
|
:preface (setq vterm-install t) ; compile the package when you load vterm
|
|
|
|
:hook (vterm-mode . doom-mark-buffer-as-real-h)
|
|
|
|
:hook (vterm-mode . hide-mode-line-mode) ; modeline serves no purpose in vterm
|
2020-08-04 14:03:06 -04:00
|
|
|
:preface
|
|
|
|
(when! (fboundp 'native-compile)
|
|
|
|
;; HACK Fix #3683: `vterm-module-compile' uses `locate-library' to determine
|
|
|
|
;; where vterm-module.so should be, but an eln file (for emacsGcc
|
|
|
|
;; users) reports a subdirectory that will never contain it; rendering
|
|
|
|
;; vterm unable to build itself.
|
|
|
|
;; REVIEW Remove this when akermu/emacs-libvterm#363 is resolved.
|
|
|
|
(defadvice! +vterm--dont-resolve-to-eln-file-a (orig-fn &rest args)
|
|
|
|
:around #'vterm-module-compile
|
|
|
|
(let ((load-suffixes (remove ".eln" load-suffixes)))
|
|
|
|
(apply orig-fn args))))
|
|
|
|
|
2019-01-27 03:45:29 +08:00
|
|
|
:config
|
2019-02-18 18:56:20 -05:00
|
|
|
(set-popup-rule! "^vterm" :size 0.25 :vslot -4 :select t :quit nil :ttl 0)
|
|
|
|
|
2020-04-23 16:53:37 -04:00
|
|
|
;; Once vterm is dead, the vterm buffer is useless. Why keep it around? We can
|
|
|
|
;; spawn another if want one.
|
|
|
|
(setq vterm-kill-buffer-on-exit t)
|
|
|
|
|
2020-01-12 20:05:26 -05:00
|
|
|
(setq-hook! 'vterm-mode-hook
|
2020-04-23 16:53:37 -04:00
|
|
|
;; Don't prompt about dying processes when killing vterm
|
2020-01-12 20:05:26 -05:00
|
|
|
confirm-kill-processes nil
|
|
|
|
;; Prevent premature horizontal scrolling
|
|
|
|
hscroll-margin 0)
|
|
|
|
|
2020-04-23 16:53:37 -04:00
|
|
|
;; Restore the point's location when leaving and re-entering insert mode.
|
2020-02-22 18:46:08 -05:00
|
|
|
(when (featurep! :editor evil)
|
2020-02-22 21:42:04 -05:00
|
|
|
(add-hook! 'vterm-mode-hook
|
|
|
|
(defun +vterm-init-remember-point-h ()
|
|
|
|
(add-hook 'evil-insert-state-exit-hook #'+vterm-remember-insert-point-h nil t)
|
2020-04-23 16:53:37 -04:00
|
|
|
(add-hook 'evil-insert-state-entry-hook #'+vterm-goto-insert-point-h nil t)))))
|