Is it possible to have vim key bindings in terminal?
I’m getting used to vim bindings (like pressing w to go to word, dw to delete a word, and such) and it’s modes (insert, normal, visual), and, out of curiosity would like to know: is there some kind of implementation of this behaviour of modes and bindings from vim to my terminal?
Have insert mode, normal mode and such…
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
It has insert and normal modes (the insert mode is default, and escape for normal mode).
When in vi normal mode, you can launch the full $EDITOR to edit the current line with v
(the same can be achieved when bash is in emacs mode with C-x C-e
).
In bash: set -o vi
You can run it at the command line for just this session or add it to your .bashrc file.
Many programs use readline
for input, and you can make any of them use vi-style keybindings by setting up your .inputrc
with
set editing-mode vi set keymap vi
In zsh, if you change your
EDITOR
environment variable, the shell will match it.All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0