A mapping with a manual insert mode in the middle

23 views
Skip to first unread message

Zeke Blackwell

unread,
Jan 17, 2017, 1:26:40 AM1/17/17
to vim_use
Greetings!

I'd like to create a mapping in my .vimrc that does some manipulation, drops me into insert mode, then picks back up for more manipulation after I hit escape.

Is this possible? I guess I just don't know what to search for.

Any help would be greatly appreciated.

Ben Fritz

unread,
Jan 17, 2017, 10:56:53 AM1/17/17
to vim_use

It *may* be possible to have your mapping set up an InsertLeave autocmd which would then fire to complete the desired actions, and delete itself.

porphyry5

unread,
Jan 18, 2017, 12:21:48 PM1/18/17
to vim_use

Does it have to be in one mapping? Why not something like

nmap _i :Do_stuff<cr>i
imap _i <Esc>:Finish_off<cr>

The only difference would be that you press _i a second time, instead of the <Esc> key.

Reply all
Reply to author
Forward
0 new messages