readline - Left key exit insert mode in bash commandline -


i in bash:

bind -m vi-insert '"{" "\c-v{}\e[d"' 

this works except after autoclosing } , put cursor in middle, exits insert mode, annoying.

the given macro assumes emacs key bindings; after inserting braces, escape sequence \e[d moves cursor 1 cell left, positioning between braces. in vi mode, \e has effect of exiting insert mode , going command mode. simple fix leave insert mode, re-enter, reposition cursor want it; no explicit cursor movement necessary.

bind -m vi-insert '"{" "\c-v{}\ei"' 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -