doomemacs/modules/tools/vterm/autoload.el
Henrik Lissner 3240238a18
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).
2019-05-17 01:58:42 -04:00

37 lines
1.3 KiB
EmacsLisp

;;; tools/vterm/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +vterm/open (arg)
"Open a terminal buffer in the current window. If ARG (universal argument) is
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)))
(vterm)))
;;;###autoload
(defun +vterm/open-popup (arg)
"Open a terminal popup window. If ARG (universal argument) is
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"))
(let ((default-directory
(if arg
(or (doom-project-root) default-directory)
default-directory)))
(vterm-other-window)))
;;;###autoload
(defun +vterm/open-popup-in-project ()
"Open a terminal popup window in the root of the current project."
(interactive)
(+vterm/open-popup t))