aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/rul-init.d/vterm.el
blob: 4d752a17191c6812dd16fab278beb5c9b8b94c06 (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
(use-package multi-vterm
:ensure t
:config

(setq vterm-source
  `(:name     "VTerm Buffer"
    :category 'buffer
    :narrow   ?t
    :face     'consult-buffer
    :action   ,#'consult--buffer-action
    :items
    (lambda ()
      (mapcar #'buffer-name
              (seq-filter
               (lambda (x)
                 (eq (buffer-local-value 'major-mode x) 'vterm-mode))
               (buffer-list))))))

(setq consult-vterm-buffer-sources
      (list
       `(:hidden nil :narrow ?t ,@vterm-source)))

(setq vterm-max-scrollback 100000)

(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)

(add-to-list 'consult-buffer-sources 'vterm-source 'append)
(add-hook 'vterm-mode-hook 'goto-address-mode)
)
nihil fit ex nihilo