Vimdiff

From Omnia
Jump to navigation Jump to search

vimdiff

Vim documentation: diff - http://vimdoc.sourceforge.net/htmldoc/diff.html

vimdiff:

vimdiff [options] file1 file2
vimdiff [options] file1 file2 file3
ctrl+w ctrl+w - switch windows
ctrl+w [right] - switch to right windows
ctrl+w [left] - switch to left windows
do - diff obtain change (do below missing)
dp - diff push changes
[c - previous difference
]c - next difference
:diffupdate - diff update ;)
:syntax off - syntax off
zo - open folded text
zc - close folded text

References:


Tips from http://amjith.blogspot.com/2008/08/quick-and-dirty-vimdiff-tutorial.html

  • If you load up two files in splits (:vs or :sp), you can do :diffthis on each window and achieve a diff of files that were already loaded in buffers
  • :diffoff can be used to turn off the diff mode.


Multiple Windows

Note: to exit, you have to close out all windows, one at a time, or use:

:wa  # write changes to all buffers
:xa  # save and exit all buffers
:qa  # quit all buffers
:qa! # quit all buffers (without saving)

If you have more than 2 windows, 'do' and 'dp' will not work. You will need to specify their full name and buffer:

:diffget [buffer]
:diffpush [buffer]

vim

See vim

keywords