I am using vimdiff
for the first time. Online I found written that to move from the left pane you use CTRL + w + Left or right arrow
This does not work for me. But I see that if I press just CTRL + w
and press w
for a sec and let it go, it switches pane after ~500ms.
Is this how it is supposed to work? Am I doing something wrong?

- 52,998
- 69
- 209
- 339
-
3Please read [`:h window-move-cursor`](http://vimdoc.sourceforge.net/htmldoc/windows.html#window-move-cursor). – glts May 22 '13 at 20:17
-
Its not supposed to be that slow. The lag on my set up is unnoticeable. Also you can use
h or l to move left or right. – FDinoff May 22 '13 at 20:17 -
please check if you have mapping with `ctrl-w w x y z` – Kent May 22 '13 at 20:22
-
@FDinoff:I tried
h but it does not work (at least in my cygwin) – Cratylus May 23 '13 at 19:32
6 Answers
Ctrl+w
and right and left arrow can be used to move between any split windows on vim, not only vimdiff splits.
These keys do work here on cygwin; also, Ctrl+w w
also moves to the next window, but without the delay you mentioned.
It is possible that you have mapped these keys in your .vimrc or via some vim plugin. You can check this with :map w
, :map <left>
and :map <right>
.
As moving between windows is something that you use often, you may consider using the following mappings:
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-H> <C-W>h
nnoremap <C-L> <C-W>l
Then you can use Ctrl+h
and Ctrl+l
to move left and right, without moving your hands from the home row. And the nnoremap
will ensure that these works despite of any other mappings that you may have.

- 8,983
- 4
- 38
- 53
-
1Thanks so much for sharing this option. VSCode makes ctrl+w unusable so these mappings helped a lot. https://stackoverflow.com/questions/73749376/vscode-how-to-switch-window-in-vimdiff-as-ctrlw-closes-the-window – A. K. Sep 16 '22 at 19:17
Press Ctrl + W and then (after releasing Ctrl + W) press the arrow keys to change the pane.

- 54,432
- 29
- 203
- 199

- 191
- 1
- 3
It is very useful to use set mouse=a
in your .vimrc
file. It gives you possibility to switch between windows using mouse. Additionally you can resize windows using it.
If you prefer to use keyboard I have also mapped arrow keys in .vimrc
in this way:
map <C-Left> <C-W>j
map <C-Down> <C-W>k
map <C-Up> <C-W>h
map <C-Right> <C-W>l

- 948
- 9
- 27
-
Grzegorz, thanks for the tip.For me **set mouse=a** worked but **set mouse=a'** showed an error. – sob May 26 '17 at 05:04
-
-
-
-
@GrzegorzBielański Hi, how am I use the keyboard with the .vimrc setting above? can I move the center divider left or right using keyboard? – Chan Kim Sep 07 '20 at 08:56
You can also use :wincmd w
for next window, and :wincmd W
for previous window.
The :wincmd
is especially useful when ctrl+w
is captured by the environment. For example see: https://stackoverflow.com/a/73749587/811335

- 34,395
- 15
- 52
- 89
To move among left and right pane, Press ctrl+w and then ctrl+r. This is both left and right vice-versa.

- 198
- 12
-
This is for window rotation, not for moving between windows. `:h ctrl-w_ctrl-r` : "Rotate windows downward/rightwards. ... The cursor remains in the same window." – Stephen C Jan 07 '21 at 21:47
Please go to differ line and do "dp" from left to right and "do" from right to left

- 13
- 3