tools/vterm: improve UI/UX
- Don't prompt about processes when killing buffer - Hide modeline in vterm buffers (doesn't do anything useful and would be consistent with settings for eshell and term modules). - Refactor +vterm/open & +vterm/open-popup - Add Emacs window redraw hack to force vterm to redraw, fixing artefacting in some edge cases. - Fix ansi-color-names-vector when solaire-mode is present, otherwise you get a mismatched background in vterm (and other terms).
This commit is contained in:
parent
ba92adf7b3
commit
3240238a18
3 changed files with 15 additions and 3 deletions
|
@ -7,11 +7,15 @@ non-nil, cd into the current project's root."
|
|||
(interactive "P")
|
||||
(unless (fboundp 'module-load)
|
||||
(user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm"))
|
||||
;; This hack forces vterm to redraw, fixing strange artefacting in the tty.
|
||||
;; Don't ask me why it works.
|
||||
(save-window-excursion
|
||||
(pop-to-buffer "*scratch*"))
|
||||
(let ((default-directory
|
||||
(if arg
|
||||
(or (doom-project-root) default-directory)
|
||||
default-directory)))
|
||||
(switch-to-buffer (save-window-excursion (vterm)))))
|
||||
(vterm)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +vterm/open-popup (arg)
|
||||
|
@ -24,7 +28,7 @@ non-nil, cd into the current project's root."
|
|||
(if arg
|
||||
(or (doom-project-root) default-directory)
|
||||
default-directory)))
|
||||
(pop-to-buffer (save-window-excursion (vterm)))))
|
||||
(vterm-other-window)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +vterm/open-popup-in-project ()
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
(add-hook 'vterm-mode-hook #'doom|mark-buffer-as-real)
|
||||
;; Automatically kill buffer when vterm exits.
|
||||
(add-to-list 'vterm-exit-functions (lambda (buffer) (if buffer (kill-buffer buffer))))
|
||||
;; Modeline serves no purpose in vterm
|
||||
(add-hook 'vterm-mode-hook #'hide-mode-line-mode)
|
||||
;; Don't prompt about processes when killing vterm
|
||||
(setq-hook! 'vterm-mode-hook confirm-kill-processes nil)
|
||||
|
||||
(when (featurep! :editor evil)
|
||||
(evil-set-initial-state 'vterm-mode 'insert)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue