Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is probably an easy question for most vim users.

I want to map :tabn to <C-Tab>. It works perfectly while I'm in normal mode but when I'm in my insert mode (typing code) it just inserts tabs characters.

In my vimrc file I have

map <C-Tab> :tabn<CR>

Any ideas? Thanks!

share|improve this question
up vote 5 down vote accepted

Try this:

:imap <C-Tab> <Esc>:tabn<CR>

That will leave you in normal mode after switching to the next tab. You could instead use this:

:imap <C-Tab> <C-O>:tabn<CR>

which will put you back into insert mode in the next tab at the position where you left the cursor in that tab.

share|improve this answer

You will need to use the imap command. You will also need to prepend <ESC> to it to make it leave insert mode first.

imap <C-Tab> <ESC>:tabn<CR>
share|improve this answer
When I did that it just inserted :tabn into my document. In normal mode it still worked as expected – coderdave May 1 '11 at 20:28
Edited accordingly, @coderdave. – Wuffers May 1 '11 at 20:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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