mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-01 20:46:12 +01:00
9bf5aa7a27
Signed-off-by: Magic_RB <magic_rb@redalder.org>
1.8 KiB
1.8 KiB
Vterm
Emacs-libvterm (vterm) is fully-fledged terminal emulator inside GNU Emacs based on libvterm, a C library. As a result of using compiled code (instead of elisp), emacs-libvterm is fully capable, fast, and it can seamlessly handle large outputs.
Vterm is "evilified" by Evil Collection.
(use-package vterm
:straight t
:init
We first have to define a new minor mode, magic_rb-koy-vterm-mode
, then hook it onto the existing vterm-mode
(define-minor-mode magic_rb-koy-vterm-mode
"Enable koy compatibility for vterm."
:lighter " koy"
:keymap (make-sparse-keymap)
(evil-normalize-keymaps))
(add-hook 'vterm-mode-hook 'magic_rb-koy-vterm-mode)
Then we actually populate the keymap using general.el.
:after (general)
:general
(:states '(motion normal visual)
:predicate 'magic_rb-koy-compat-p
:keymaps 'magic_rb-koy-vterm-mode-map
"t" 'evil-backward-char
"r" 'evil-previous-visual-line
"n" 'evil-next-visual-line
"s" 'evil-forward-char
"h" 'evil-find-char-to
"j" 'evil-replace
"k" 'evil-search-next
"l" 'evil-substitute)
(:states '(insert)
:predicate 'magic_rb-koy-compat-p
:keymaps 'magic_rb-koy-vterm-mode-map
"j" (general-key-dispatch 'self-insert-command
:timeout 0.25
"j" 'evil-normal-state)))