Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennisfaust/9404dd81bb533472a8bbd1b06e12027a to your computer and use it in GitHub Desktop.
Save dennisfaust/9404dd81bb533472a8bbd1b06e12027a to your computer and use it in GitHub Desktop.
Set VI Mode in Readline
tl;dr:
$ set -o vi
$ bind '"\ee": emacs-editing-mode'
Then hit Esc-e
$ bind -P| grep edit
edit-and-execute-command can be found on "\C-x\C-e".
emacs-editing-mode is not bound to any keys
vi-editing-mode is not bound to any keys
You can do the following so that when you type Esc+e it will toggle between the 2 modes.
$ set -o emacs
$ bind '"\ee": vi-editing-mode'
$ set -o vi
$ bind '"\ee": emacs-editing-mode'
The bind command now shows this:
in vi mode
$ bind -P |grep edit
edit-and-execute-command is not bound to any keys
emacs-editing-mode can be found on "\ee".
vi-editing-mode is not bound to any keys in emacs mode
$ bind -P |grep edit
edit-and-execute-command can be found on "\C-x\C-e".
emacs-editing-mode is not bound to any keys
vi-editing-mode can be found on "\ee".
Now you can use Esc+e to toggle between the 2 different modes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment