I use zsh and I've recently learned bindkey -v
binds useful Vim keybinds at once, but I also realized that, when I use bindkey -v
, all default (Emacs-like) keybinds are disabled.
I want to use Emacs-like keybinds when I'm in the insert-mode, while Vim keybinds are also enabled when I'm in the normal-mode.
Can I use both Emacs and Vim keybinds in zsh ? And if yes, how can I do ?
Overview. Vim-mode is another implementation for Vi and Vim-like key bindings for Emacs. It is a complete new implementation from scratch with extensibility in mind. There are several other packages emulating Vim features, see CategoryEmulation for an overview.
Yes, you can. It is even part of the default bindings.
To get emacs-like bindings for "insert-mode", you simply set emacs as default keymap. This is already the case, unless either of the VISUAL
or EDITOR
environment variables contain the string vi
and unless you set it to viins explicitly with bindkey -v
. You can also set it explicitly with bindkey -e
.
From emacs mode you can then switch to vicmd mode ("normal-mode") with the key sequence ^X^V
, that is Ctrl+x followed by Ctrl+v. To get back to emacs mode just type any key sequence that would normally get you to viins mode ("insert-mode") with vi-like bindings, e.g. i or a.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With