Is there any way to enable Ctrl+L to clear screen when 'set -o vi' is set?

Ctrl+L is also bound in vi command mode but not in insert mode. There's no default binding for clear-screen in insert mode. Readline bindings should be specified in ~/.inputrc, like so:

set editing-mode vi
$if mode=vi

set keymap vi-command
# these are for vi-command mode
Control-l: clear-screen

set keymap vi-insert
# these are for vi-insert mode
Control-l: clear-screen 
$endif

This will bind Ctrl+L to clear the screen in both normal and insert mode. Naturally, if you prefer to only use it in one mode, just remove the relevant option.

If you prefer to set this just for bash use the following equivalents in ~/.bashrc:

set -o vi
bind -m vi-command 'Control-l: clear-screen'
bind -m vi-insert 'Control-l: clear-screen'

There is an extensive list of readline commands that you can use to customize your bash shell with.


Put this line in your bashrc:

bind -m vi-insert "\C-l":clear-screen