Theses questions are about GNU Readline's vi mode providing vi-like commands inside your terminal. Use this tag for questions about configuring or operating vi mode (e.g., Bash integration, setting keybindings).
vi-mode should be use for questions pertaining to the vi mode of the GNU readline command line editing library. Use this tag for questions about configuring or operating vi mode (e.g., using it with Bash, setting keybindings).
GNU Readline's vi mode provides vi-like commands for line-editing and history interaction in interactive programs with a command-line interface such as Bash or Python. Here is a list of some of the available commands:
- ^ move cursor to start of line
- $ move cursor to end of line
- b move cursor back a word
- w move cursor forward a word
- e move cursor to the tend of next word
To use and configure vi mode in Bash and any other program that uses GNU Readlines you need to edit readline's config file: ~/.inputrc. See inputrc for questions and answer about its syntax. You should start by adding
set editing-mode vi
in your ~/.inputrc.
If you only want to use vi mode in Bash, you can activate it by adding
set -o vi
in your ~/.bashrc.
Further reading
- What is meant by a shell is in “vi” mode or “emacs” mode?
- How to unset set -o vi?
- How do I perform a reverse history search in ZSH's vi-mode?
- How to enable yank-nth-arg using vi mode on Bash?