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
Post a Comment