2019-02-17 00:03:36 +08:00
|
|
|
;;; tools/vterm/autoload.el -*- lexical-binding: t; -*-
|
2019-01-27 03:45:29 +08:00
|
|
|
|
|
|
|
;;;###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")
|
2019-03-13 20:20:19 -04:00
|
|
|
(unless (fboundp 'module-load)
|
|
|
|
(user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm"))
|
2019-05-17 01:55:01 -04:00
|
|
|
;; 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*"))
|
2019-01-27 03:45:29 +08:00
|
|
|
(let ((default-directory
|
|
|
|
(if arg
|
|
|
|
(or (doom-project-root) default-directory)
|
|
|
|
default-directory)))
|
2019-05-17 01:55:01 -04:00
|
|
|
(vterm)))
|
2019-01-27 03:45:29 +08:00
|
|
|
|
|
|
|
;;;###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")
|
2019-03-13 20:20:19 -04:00
|
|
|
(unless (fboundp 'module-load)
|
|
|
|
(user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm"))
|
2019-01-27 03:45:29 +08:00
|
|
|
(let ((default-directory
|
|
|
|
(if arg
|
|
|
|
(or (doom-project-root) default-directory)
|
|
|
|
default-directory)))
|
2019-05-17 01:55:01 -04:00
|
|
|
(vterm-other-window)))
|
2019-01-27 03:45:29 +08:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun +vterm/open-popup-in-project ()
|
|
|
|
"Open a terminal popup window in the root of the current project."
|
|
|
|
(interactive)
|
|
|
|
(+vterm/open-popup t))
|