diff options
Diffstat (limited to '.emacs.d/rul-init.d')
-rw-r--r-- | .emacs.d/rul-init.d/vterm.el | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/.emacs.d/rul-init.d/vterm.el b/.emacs.d/rul-init.d/vterm.el index 54abbbf..28c54e9 100644 --- a/.emacs.d/rul-init.d/vterm.el +++ b/.emacs.d/rul-init.d/vterm.el @@ -3,4 +3,39 @@ :config (setq vterm-max-scrollback 100000 -)) +) + +(defvar vterm-source + `(:name "VTerm Buffer" + :category 'buffer + :narrow ?t + :face 'consult-buffer + :history 'buffer-name-history + :state #'consult--buffer-state + :new + (lambda (name) + (with-current-buffer (get-buffer-create name) + (insert "#+title: " name "\n\n") + (vterm) + (consult--buffer-action (current-buffer)))) + :items + (lambda () + (mapcar #'buffer-name + (seq-filter + (lambda (x) + (eq (buffer-local-value 'major-mode x) 'vterm-mode)) + (buffer-list)))))) + +(add-to-list 'consult-buffer-sources 'vterm-source 'append) + +(setq consult-vterm-buffer-sources + (list + `(:hidden nil :narrow ?v ,@vterm-source))) + +(defun consult-vterm-buffer () + "Switch to a vterm buffer" + (interactive) + (consult-buffer consult-vterm-buffer-sources)) + +(bind-key "C-x b" 'consult-vterm-buffer vterm-mode-map) +) |