4

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?

1 Answer 1

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.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.