From ac58616752652cf6203f9562a9137ab45e2d57d5 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 12 Jan 2022 02:18:18 +0000 Subject: vterm redux --- init.org | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'init.org') diff --git a/init.org b/init.org index b408eae..e538734 100644 --- a/init.org +++ b/init.org @@ -1793,10 +1793,35 @@ (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) #+end_src +*** vterm + #+begin_src emacs-lisp :tangle no + (defvar jao-use-vterm nil) + + (use-package vterm + :ensure t + :init (setq vterm-kill-buffer-on-exit t + vterm-copy-exclude-prompt t + jao-use-vterm t) + :config (jao-define-attached-buffer "\\*vterm\\*" 0.5) + :bind (("" . vterm))) + + (use-package eshell-vterm + :ensure t + :config (eshell-vterm-mode)) + + (defun jao-exec-in-vterm (cmd bname) + (if (string-blank-p (or cmd "")) + (vterm) + (let ((vterm-shell cmd) + (vterm-kill-buffer-on-exit t) + (buff (generate-new-buffer bname))) + (switch-to-buffer buff) + (vterm-mode)))) + + #+end_src *** term #+begin_src emacs-lisp (defvar-local jao-term--cmd nil) - (defvar jao-use-vterm nil) (defun jao-term--find (cmd) (seq-find (lambda (b) @@ -1935,10 +1960,8 @@ ***** Completion #+begin_src emacs-lisp (defun jao-eshell-completion-capf () - (let ((c (bash-completion-dynamic-complete-nocomint - (save-excursion (eshell-bol) (point)) - (point) - t))) + (let* ((b (save-excursion (eshell-bol) (point))) + (c (bash-completion-dynamic-complete-nocomint b (point) t))) (when (and c (listp c)) (append c '(:exclusive no))))) -- cgit v1.2.3