Setting vi Mode for Command Line Editing

The default mode for command line editing in the BASH shell is EMACS mode. To change to vi mode as an individual user use the following command. To make the change permanent add the command to ~/.bashrc.

set -o vi

Note that -o is lowercase letter “o”.

You can then source the ~/.bashrc file to activate vi editing mode.

source ~/.bashrc


. ~/.bashrc

Where the dot (.) command is a shortcut for typing out the entire source command.

You can also make this the default for all users by adding the set command to /etc/bashrc file.

Leave a Reply