Last Updated: February 25, 2016
·
1.255K
· piotrj

Use vi bindings in your bash/zsh

Usually the shell has emacs bindings enabled. But if you are more familiar with vim you can turn on vi bindings:

set -o vi

And there you go. Now after typing the command you can hit Escape and you are in 'normal' mode. You can use w, b or e to move around. You can also use ^ or $ to jump to the begining of the line. I or A works as well. If you want to delete a word you can go with dw or dd to delete the entire line. Unfortunately stuff like diw or daw does not work. Moreover if you want to search in the history of your shell commands just hit / and type in your term of course followed by enter. Then you can use n or N to jump to next or previous match.

If you are more familiar with vim than you are with emacs, try it out.