I am trying to map the key sequence Ctrl-W arrow key to navigate between open split windows in Vim. I find it a bit too complicated to press 3 keys to move between open windows so ideally I would like to map this sequence to the sequence I normally use in Terminator Alt-arrow key. For example, in Terminator I would press Alt-Left to move one window to the left, Alt-Down to move one window to the bottom, etc.

I have tried following Vim key mappings page and tried this:

:map <press Alt-Down> <press Ctrl-W><press Down>

but it doesn't work. No error message. Nothing happens.

I've also tried this:

:map <A-Down> <C-W><Down>

but it doesn't work either.

Do I miss anything? How do I map Ctrl-W arrow to Alt-arrow?

  • See vi.stackexchange.com/questions/2350/how-to-map-alt-key You need to figure out what your terminal is producing and then tell vim what to expect – Mass Feb 12 '18 at 3:48
  • @Mass how do I figure out what my terminal produces? – jedi Feb 13 '18 at 11:41
  • on the command line, press control+V then press alt+down and see what is typed out (you should be able to do this both in vim's command line or directly in your terminal) . – Mass Feb 13 '18 at 12:57
  • On Terminator, when I press control+v and then alt+<right arrow> nothing happens. However, when I then release alt and press <right arrow> alone I get some input, like ^[[C. So I press alt+<arrow right> and <arrow right> and I get ^[[C. Is this is a problem? On a regular Ubuntu Terminal it works. I get ^[[1;3A. Do does this situation make me dependant on using Terminal for Vim? – jedi Feb 14 '18 at 10:25

Browse other questions tagged or ask your own question.