I have several files opened in tabs in Vim. I want to switch between tabs, so I use Ctrl+left to move left (previous) and for next also. But my mapping doesn't work.

:map <C-Left> :tabprevious<CR>
:map <C-Right> :tabnext<CR>

I tried in shift+arrow combinations. It doesn't work in command line as well as vimrc also.

  • 6
    Why not gt and gT?
    – romainl
    May 10, 2016 at 7:33
  • 1
    Thanks. It works. :) Can you tell me what causes my mapping not to work?
    – SibiCoder
    May 10, 2016 at 7:39
  • 5
    @SibiCoder Maybe because Vim didn't set up the modified arrow keys. In your vimrc, you could try adding this line exe "set <xRight>=\e[1;*C" | exe "set <xLeft>=\e[1;*D". If this doesn't work, could you post what is displayed in a Vim buffer when you insert a literal <C-Left> (<C-V> then <C-Left> in insert mode)? Or maybe <C-Left> is already bound to some function in your terminal emulator, so Vim never receives this keystroke. May 10, 2016 at 7:44
  • 2
    I can say that it works for me. Maybe (just maybe) you've remapped arrows or something. You can try show us your vimrc. May 10, 2016 at 7:44
  • 4
    Try with $ vim -Nu NONE.
    – romainl
    May 10, 2016 at 9:25

1 Answer 1


The following answer on stackoverflow explains why this is impossible:

Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished.

  • 1
    The post you quote is totally outdated. Currently <C-Left> and <C-Right> do work in gVim, and, depending on terminal, in plain Vim too.
    – Matt
    Oct 30, 2019 at 17:39
  • 1
    @Matt not for me they don't, but that's because macOS intercepts them to change workspaces
    – D. Ben Knoble
    Mar 28, 2020 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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