2

I know there is, for readline,

set editing-mode vi

You can put the above option in ~/.inputrc, editing-mode is documented by Readline as

editing-mode (emacs) Controls whether readline begins with a set of key bindings similar to emacs or vi. editing-mode can be set to either emacs or vi.

There is also, for Bash,

set -o vi

According to the Bash documents

vi Use a vi-style line editing interface. This also affects the editing interface used for read -e.

Does Bash's -o vi do anything other than set the appropriate Readline mode? And, if you've already got editing-mode set in your ~/.inputrc does this do anything differently?

4

The two are identical.

Doing set -o vi in an interactive bash shell calls the set builtin. The C code for the set builtin calls rl_variable_bind("editing-mode", option_name) (where option_name will be vi) which is the Readline library function that sets the command line editing mode.

Setting the command line editing mode on the command line with set -o in the bash shell would override the corresponding setting configured in ~/.inputrc.

Setting the editing mode in ~/.inputrc would set it as the default command line editing mode for any application using the Readline library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.