blob: 28c54e953cbc014a32a5c57d7561b4312ebfc638 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
(use-package multi-vterm
:ensure t
: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)
)
|