Quick and Dirty : Vimdiff Tutorial

Wednesday, August 27, 2008

I recently started using exclusively Vim (and gVim) for my coding needs. Vimdiff is a tool that comes bundled with Vim and its a wonderful tool for comparing code and merging changes. If you'd prefer to use a non-Vim based diff tool, checkout visual diff tools in linux for more variety.


Keyboard Shortcuts:

do - Get changes from other window into the current window.

dp - Put the changes from current window into the other window.

]c - Jump to the next change.

[c - Jump to the previous change.

Ctrl W + Ctrl W - Switch to the other split window.


10 comments:

Casey said...

Thanks, I've been looking everywhere for this.

mkoga said...

Very cool, thanks for the tip!

yungchin said...

Thanks! Just what I was looking for.

Partha Chatterjee said...

Thanks a lot! I was looking around for these commands frantically. Its a great help. Thanks.

angel said...

thanks a loads.... :) Jai ho!!

Alan Haggai Alavi said...

Hi,

Nice information. However, `Ctrl W + Ctrl W' is not required to switch windows. Ctrl W + W is enough to cycle windows. You can try Ctrl W + <any of the direction keys> to switch among windows in vimdiff or in vim with split windows.

For example:
Ctrl W + L => Switch to the right window, which is similar to pressing Ctrl W + <Right arrow>.

Regards.

Saggi Malachi said...

Great quick tutorial.
Exactly what I was looking for.

Anonymous said...

Thanks for the great tip

peerlessdeepak said...

Nice one! I learnt vimdiff from it.

while(As long as i remember vimdiff)
Thanks

Anonymous said...

To ignore whitespace use this command: set diffopt+=iwhite

To turn that back off use: set diffopt-=iwhite

Post a Comment

Core Dump. 2008 One Winged Angel.Bloggerized by : GosuBlogger