Questions tagged [vimdiff]

The diff feature of vim lets show differences between two, three or four versions of the same file

The easiest way to start editing in diff mode is with the "vimdiff" command. This starts Vim as usual, and additionally sets up for viewing the differences between the arguments.

vimdiff file1 file2 [file3 [file4]]

This is equivalent to:

vim -d file1 file2 [file3 [file4]]

Source: vimdoc

121 questions
208
votes
11 answers

How do I use Vim as a diff tool?

I use Vim as my primary editor. I would also like to use vim to diff files and modify the files while doing the diff to fix easy changes (rather than most diff techniques which are a cycle of diff, fix, diff, fix). Additionally are there easy ways…
Martin York
  • 6,542
  • 4
  • 20
  • 26
25
votes
4 answers

Better diff color scheme

I've started using diff mode in vim at work, and the one thing I noticed is that the colors are really bright, which doesn't help when you're trying to look for differences in huge files for long periods of time. Are there any color schemes out…
mjuarez
  • 353
  • 1
  • 5
  • 10
22
votes
2 answers

How do I enter into vimdiff mode given two splits are already open?

I know you would normally enter into vimdiff mode from the terminal with vimdiff file1 file2. However, I frequently find myself already in vim with multiple different splits, and I'd like to run vimdiff on two specific splits, and then turn vimdiff…
Aeroblop
  • 323
  • 2
  • 4
20
votes
1 answer

More detailed comparison within a line

I use vimdiff to inspect differences between files, and some times it misses out a bit. for example, if I have the following two files: //a.c printf("Hello\n"); and: //b.c int i = printf("hello\n") + 3; showing them in vimdiff gives: What I will…
elyashiv
  • 2,429
  • 2
  • 18
  • 23
14
votes
1 answer

Word level diffs in Vim

As far as I understand the default vimdiff is doing only line-wise diffs. However sometimes is useful to do word level diff, especially for text files like Markdown, LaTeX etc. There are some tools like wdiff or dwdiff which do the diff in word…
corion
  • 311
  • 2
  • 7
14
votes
1 answer

Using Vimdiff to diff two things that are not local documents

Every now and then I want to diff two random things (like a source-code vs some code I find online). I could obviously create two files locally and diff them, - but I was wondering if there was a way to open Vimdiff with two empty documents (not to…
Zeth
  • 405
  • 3
  • 12
8
votes
1 answer

How can I suppress the "press enter" prompt when opening files in diff mode?

When using gVim (on Windows; see below) to diff two files which both have very long paths relative to the current working directory, the dreaded "press enter" prompt appears during load, before rendering any of the useful diff information. "Very…
user72
5
votes
0 answers

VIMDIFF missing small differences

I have two nearly identical very large files (890,000+ rows of exactly 899 characters each fixed length file). On rows 289141-289148 one file has a pipe character in column 38, and the other file has a space in that position. If I force vimdiff to…
4
votes
1 answer

Get a vimdiff view of changes made by a patch / diff file

How do I get a vimdiff view of the effects of patching a file?
Tom Hale
  • 2,681
  • 14
  • 32
4
votes
1 answer

Is it possible to use vimdiff's side by side view with a regular diff file?

Given a patch (without having both files, e.g.) git show -c > some_patch.c, is it possible to view this patch in vimdiff with a side-by-side view? Or does this require having both source and destination files?
ideasman42
  • 3,733
  • 3
  • 27
  • 34
4
votes
1 answer

Vimdiff line count of different lines

is there a way to number the lines that are different in vimdiff? Is there a way to count the lines that are different in vimdiff?
cokedude
  • 141
  • 2
4
votes
0 answers

Can diff mode empty lines be utilized outside diff mode?

In diff mode, deleted lines are indicated by a colored block (green below). The 'number' line numbers are skipped for this block. Is it possible to emulate this behavior (screen-width colored blocks that act as separators) with Vim commands in a…
dannyadam
  • 482
  • 2
  • 6
4
votes
1 answer

How to jump to the line of a diff?

If I have a diff file open in vim (not vimdiff), is there a way to jump to the line under the cursor? Something like this: Detect the hunk of text under the cursor. Open a buffer for the file containing the hunk(perhaps an existing buffer if one is…
ideasman42
  • 3,733
  • 3
  • 27
  • 34
4
votes
1 answer

Multi-command with normal mode and execute mode

Using vimdiff, I can compare two files and generate it's corresponding HTML via the following command: : TOhtml | wq | q | q (the wq will save the Diff.html file, and the two qs will quit out of the two vimdiffing files.) Before I output to the…
xfern
  • 43
  • 4
4
votes
1 answer

vimdiff two files, one ro the other rw

I am scripting a diff program between two longs paths and want one file to be read-only and the other to be read-write. e.g. I want to run something like srcdiff test.c and my script will expand that to vimdiff test.c /long/path/to/other/test.c I…
1
2 3