0

I wan't to map jump shortcut for insert mode such as

imap <A-w> <Esc>wi
imap <A-b> <Esc>bi

Even though <A-b> works perfectly. <A-w> appear to not work properly.

How can I map <A-w> for insert mode that it will jump ahead 1 word but still maintain the insert mode?

2
  • 1
    You might want to try inoremap and <C-o>w instead of <esc>wi (idem for <C-o>b). – D. Ben Knoble Aug 28 '20 at 19:49
  • @D.BenKnoble it works. Thank you so much – Tran Thien Chien Aug 29 '20 at 16:10
2

From my comment:

You might want to try inoremap <A-w> <C-o>w and inoremap <A-b> <C-o>b

Control-o is like a oneshot normal mode: you get one “operation”, and then you’re back in insert mode. I rarely use it except in mappings, though I don’t tend to move around much in insert mode.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.