rochem
rochem

Reputation: 313

Shell with vim-editing shortcuts

Is there any shell in which you can edit your commands with vim shortcuts? Ideally, you would be in insert mode so that it wouldn't make any difference with other shells, but you could also use escape to go to normal mode and use vim commands. Thanks!

Upvotes: 1

Views: 1028

Answers (3)

ZyX
ZyX

Reputation: 53644

Readline library itself can do this: instead of using set -o vi in bash, add set editing-mode vi to ~/.inputrc. Bash and some other programs use readline, so you will get vi-like editing in them. Zsh does not, but it has its own implementation of vi-like editing mode (see @weronika's answer).

Upvotes: 1

weronika
weronika

Reputation: 2629

zsh can do that. Put this in your .zshrc to default to vim insert mode:

bindkey -v

Upvotes: 3

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798814

bash can be told to enter vi mode via set -o vi. See the man page for more details.

Upvotes: 3

Related Questions