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, 2020 at 19:49
  • @D.BenKnoble it works. Thank you so much Aug 29, 2020 at 16:10

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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