Reputation: 1
In vim, the switch-window-key , <C-w><C-w>
(press 2 times), is not comfortable to me, so I want to change it to <C-Tab>
. What I do: adding map <C-w><C-w> <C-Tab>
to the config file ~/.vimrc
, but it does not work as if shortcut <C-Tab>
has been used.
I'm not sure whether <C-w><C-w>
is the right representation of the toggle window command,either. So how can I make it work pressing <C-Tab>
?
Upvotes: 0
Views: 635
Reputation: 4440
it's better to map it that way, so you can toggle between windows with more flexibility:
map <c-j> <c-w>j "move up
map <c-k> <c-w>k "down
map <c-l> <c-w>l "right
map <c-h> <c-w>h "left
Upvotes: 0
Reputation: 196886
First, the order of your mapping is wrong, you should do:
<map command> <desired shortcut> <action>
so, you should write your mapping like that:
map <C-Tab> <C-w><C-w>
and most certainly use nnoremap
instead of map
.
But <C-Tab>
is an unreliable shortcut that won't work in many context so you should avoid it. I'd advise you to use <leader>
(:help mapleader
) or some other - better supported -- shortcut.
Note that <C-w><C-w>
is not that bad: you just press Ctrl
and hit ww
. That's not that big of a deal.
Upvotes: 3