3

I am using Vim version 8.0 and I would like to use <M-Up>, <M-Down>, <M-Left> and <M-Right> for navigating from window to window during insert mode. I am unable to get this work. These are the key-bindings in my ~/.vimrc:

inoremap <M-Left> <C-w><Left>
inoremap <M-Right> <C-w><Right>
inoremap <M-Up> <C-w><Up>
inoremap <M-Down> <C-w><Down>

In normal mode, things work. That is, when the key maps are changed from inoremap to noremap. Would someone have an idea how i can troubleshoot the problem or what is wrong in my above configuration?

3

You need to use :h i_CTRL-O. From the help docs:

CTRL-O      execute one command, return to Insert mode

Try these:

inoremap <M-Left>  <C-O><C-w><Left>
inoremap <M-Right> <C-O><C-w><Right>
inoremap <M-Up>    <C-O><C-w><Up>
inoremap <M-Down>  <C-O><C-w><Down>

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.