I have set vi-mode in my ~/.inputrc. The command-mode keybinds seem to work fine whereas the insert-mode keybindings do not have any effect at all.

Specifically, the following are my insert mode mappings from my ~/.input

# these are for vi-insert mode
set keymap vi-insert
"\e\e[A": history-search-backward
"\e\e[B": history-search-forward
Control-l: clear-screen
Control-p: previous-history
Control-n: next-history
# Two escapes clear command line. (Use C-c or \eC\eC instead)
"\e\e": "\e0\C-ki"

None of these mappings work in insert mode. I have the same mappings in command-mode and they all work fine.

As a concrete example, if I press C-l in the bash shell on gnome-terminal, it simply echoes ^L on the screen, whereas in command mode, it correctly clears the screen. I do not understand why this is happening?

How can I fix this problem, and get insert-mode vi keybindings to work with the GNU readline library?

Your Answer

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

Browse other questions tagged or ask your own question.