Questions tagged [vimdiff]

vimdiff is a vim mode that can show differences between two, three or four files.

vimdiff is the same as vim -d or using :diffthis on several windows in the same vim tab.

Use dp to propagate a difference and do to get it, ]c and [c to navigate between differences.

202 questions
321
votes
4 answers

How can I expand/collapse a diff sections in Vimdiff?

I've started using vimdiff today, and wanted to do some of the things that I've taken for granted on Windows based diff editors (like expand/collapse a diff section, have full file expansion/only diffs with three context lines above or below, etc.).…
TCSGrad
  • 11,898
  • 14
  • 49
  • 70
251
votes
5 answers

Viewing all `git diffs` with vimdiff

I setup git diff to wrap into vimdiff, using "Git Diff with Vimdiff" as a guide, and it's working as expected unless there are many files with changes. When there are multiple files with changes and I run git diff, it opens the first file and,…
chuckg
  • 9,195
  • 7
  • 28
  • 26
178
votes
14 answers

Load different colorscheme when using vimdiff

How to load a different colorscheme when doing vimdiff. I want this because the my current colorscheme does not show some diffs properly in vimdiff, For. eg some diff is shown with same fg/bg color. This makes it very hard to understand the diff.…
CodeRain
  • 6,334
  • 4
  • 28
  • 33
125
votes
4 answers

Take diff of two vertical opened windows in Vim

I've have two files opened. They are opened in vertical mode, next to next. Can I instantly diff these two files without leaving or closing Vim ?
Fatih Arslan
  • 16,499
  • 9
  • 54
  • 55
123
votes
4 answers

Diff two tabs in Vim

Scenario: I have opened Vim and pasted some text. I open a second tab with :tabe and paste some other text in there. Goal: I would like a third tab with a output equivalent to writing both texts to files and opening them with vimdiff. The closest I…
davetapley
  • 17,000
  • 12
  • 60
  • 86
110
votes
7 answers

DIFF utility works for 2 files. How to compare more than 2 files at a time?

So the utility Diff works just like I want for 2 files, but I have a project that requires comparisons with more than 2 files at a time, maybe up to 10 at a time. This requires having all those files side by side to each other as well. My research…
Javed Ahamed
  • 2,804
  • 6
  • 32
  • 41
81
votes
6 answers

Is there a way to configure vimdiff to ignore ALL whitespaces?

I'm using vim -d file1 file2 in order to see the differences between them. This works fine, but I want to ignore whitespace changes - they are irrelevant for source code files. Vim help states that the following command will do the magic: set…
grigoryvp
  • 40,413
  • 64
  • 174
  • 277
69
votes
15 answers

How do you exit vimdiff mode in vim, specifically, for Fugitive?

I am using vim with the fugitive extension. It has a :Gdiff command which brings you into vimdiff mode, but what is the right/quick way to close/quit vimdiff mode? I.e., let's say I am editing the file FooBar.txt under Git repository. I fire up…
wik
  • 2,462
  • 1
  • 24
  • 29
62
votes
3 answers

How do I toggle between a Vertical and a Horizontal split in vimdiff?

I already know how to use the diffopt variable to start diff mode with horizontal/vertical splits but not how to toggle between the two when I already have two files open for comparison. I tried the accepted answer found in this older post, but to…
drapkin11
  • 1,205
  • 2
  • 12
  • 24
57
votes
1 answer

How do I quit/exit all windows/buffers/splits/tabs at once in Vim or vimdiff?

How do you quit all windows with a single command in Vim or vimdiff? :q only quits out of the active window, so then a separate :q is needed to close each window.
Rob Bednark
  • 25,981
  • 23
  • 80
  • 125
56
votes
4 answers

How can I view git diff for any commit using vim-fugitive?

vim-fugitive side-by-side git diff is great for viewing diff of unstaged files. How can I use vim-fugitive to git diff staged files? any git revision?
Sathish
  • 20,660
  • 24
  • 63
  • 71
51
votes
5 answers

Save vimdiff output?

I google'd this multiple times in the past but I've never found an answer. Is there a way to save vimdiff's output (preferably while maintaining colors, highlights, etc.)? I'd like to send this one output file to other people and tell them "just…
danns87
  • 1,020
  • 1
  • 9
  • 11
51
votes
1 answer

Navigate to next conflict with vimdiff

In vimdiff you can use [c and ]c to go to the previous or next change, but when doing three-way merging many of those changes are not conflicts. Is there a command to go to the next conflict, not the next change as in e.g. Kaleidoscope?
Andreas Järliden
  • 1,884
  • 1
  • 17
  • 16
50
votes
6 answers

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…
Cratylus
  • 52,998
  • 69
  • 209
  • 339
46
votes
4 answers

use vimdiff with a diff file

How can I use vimdiff to view the differences described in a diff file?
user14437
  • 3,130
  • 5
  • 21
  • 13
1
2 3
13 14