Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vimdiff and move among left and right pane

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?

like image 739
Cratylus Avatar asked May 22 '13 20:05

Cratylus


People also ask

How do I move between windows in Vimdiff?

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.

How do I copy and paste in Vimdiff?

Use dp for copying the current difference block to another side, do for copying from another side to the current. dp means "put", do means "obtain". The current difference block is where your caret is.


2 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.

like image 69
mMontu Avatar answered Sep 30 '22 16:09

mMontu


Press Ctrl + W and then (after releasing Ctrl + W) press the arrow keys to change the pane.

like image 45
jonny_sod Avatar answered Sep 30 '22 15:09

jonny_sod