Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I like to use tab to jump between split windows, so I have map <tab> <C-W><C-W> in my .vimrc. Yet I noticed that this makes it so that Ctrl+I doesn't behave as Ctrl+I anymore, but as Ctrl+W, Ctrl+W. How can I remap just <tab> but not <C-i>?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.

share|improve this answer

Not all shortcuts are possible in Vim especially if it iss under a terminal. I do not recommend using a tab shortcut for that purpose. But an alternative solution might be the following:

" Note: Allows faster switching between windows with "Ctrl+w"! By Questor
nnoremap <silent> <C-w> <C-w><C-w>
inoremap <silent> <C-w> <Esc><C-w><C-w>
vnoremap <silent> <C-w> <Esc><C-w><C-w>

See an example of use in https://github.com/eduardolucioac/groovim/blob/master/.vimrc

[]'s

share|improve this answer

Your Answer

 
discard

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.