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
45
votes
5 answers

How to ignore some differences in diff command?

diff has an option -I regexp, which ignores changes that just insert or delete lines that match the given regexp. I need an analogue of this for the case, when changes are between two lines (rather then insert or delete lines). For instance, I want…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
43
votes
6 answers

How to ‘diff’ two subroutines in the same file in Vim?

Is it possible to diff or even vimdiff two very similar subroutines occurring in the same file? If so, how? I can think of copying the two subroutines in two separate files and then diff them, but is there a way to do it within the original file?
Nigu
  • 2,025
  • 2
  • 22
  • 31
43
votes
8 answers

Forcing vimdiff to wrap lines?

When diffing 2 files in VIM, I prefer the lines to be wrapped. However, vimdiff sets wrap to off by default. Is there a way to set line wrap automatically for every diff?
mgouin
  • 552
  • 1
  • 4
  • 10
41
votes
4 answers

compare contents of two directories on remote server using unix

I am new to unix and need some help here. I have two directories present on two different server. both the directories contains the same files. Now i want to check if all files are in sync in both the directories. If files are not in sync then i…
DSD
  • 591
  • 2
  • 9
  • 19
31
votes
4 answers

vimdiff and MacVim

I'd like to run vimdiff on MacVim. Is there an easy way I'd be able to do it?
Antonio
  • 313
  • 1
  • 3
  • 7
29
votes
5 answers

Why does git mergetool open 4 windows in vimdiff? (I'd expect 3)

When I met a conflict, I tried to use git-mergetool to solve it. I typed: >git mergetool -t vimdiff It opened vimdiff in 4-way, not 3-way. My split windows in vimdiff look like: :ls 1 #a "Gemfile.lock" line 1 2 %a …
Lai Yu-Hsuan
  • 27,509
  • 28
  • 97
  • 164
28
votes
2 answers

git and vimdiff - close all files at once

When using vimdiff with git and lots of changed files, vimdiff will open each file sequentially. It opens up the next file once you have closed the current file. But what if I just want to break out of the whole diff process and also do not want to…
lockdoc
  • 1,539
  • 1
  • 18
  • 31
27
votes
2 answers

How can I split horizontally across several vertically split windows in Vim?

Basically, I want to go from 1) to 2) I usually do this by splitting horizontally first and then vertically, but as I want this to do three-way diffs, it is much handier to start vim by running: $ vimdiff file1 file2 file3 And then doing something…
Jacobo de Vera
  • 1,863
  • 1
  • 16
  • 20
26
votes
3 answers

How to open a new window below a split created by vimdiff?

If, at a command prompt, I run vimdiff file1 file2 I get a vim instance that has two files open side-by-side, something like this: ╔═══════╤═══════╗ ║ │ ║ ║ │ ║ ║ file1 │ file2 ║ ║ │ ║ ║ │ …
user82216
25
votes
3 answers

How to prevent git vimdiff from opening files as read-only?

I'm trying to use vimdiff as a diff tool for Git but, for some reason, the files are always open in read-only mode. It makes sense for the original file but not for the ones that I have modified (since I haven't committed them yet). This is my…
laurent
  • 88,262
  • 77
  • 290
  • 428
24
votes
4 answers

git, vimdiff and dirdiff

I'm trying to use vimdiff+dirdiff.vim to diff inside Vim multiple files versionned with Git. For Mercurial, it is possible with mercurial extdiff extension. The only way I found on the web to integrate Vim with Git diff is to use vimdiff on a singe…
user744629
  • 1,961
  • 1
  • 18
  • 27
22
votes
2 answers

Applying an option to all opened files in Vim

I do a vimdiff on 2 files. Now if I want to wrap 2 files then I need to apply :set wrap 2 times to each file separately. Is there any way I can apply set wrap to both of them simultaneously without running same command twice?
ravi
  • 3,304
  • 6
  • 25
  • 27
21
votes
4 answers

Use vimdiff to replace entire file?

I'm using vimdiff for a git merge. Is there a quick way to select 1 file to use, right now i'm just selecting everything from one buffer, replacing the $MERGE with that, and then saving. I guess I can macro that, but was wondering if there is a…
mazlix
  • 6,003
  • 6
  • 33
  • 45
21
votes
4 answers

vimdiff between current and previous git version of a file

Is there a way of using vimdiff to compare the current version of a file and the same file n git versions ago? For example, I'm working on the file foo.c on the branch master. I'd like to do a vimdiff between foo.c and foo.c from master~10, to copy…
Sonia Hamilton
  • 4,229
  • 5
  • 35
  • 50
20
votes
1 answer

What's the difference between vimdiff and vimdiff2 in git?

What's the difference between them? My search engine results talk only about vimdiff, yet the command git mergetool offers me both.
nomadStack
  • 405
  • 2
  • 4
  • 11
1
2
3
13 14