Questions tagged [vimdiff]
22 questions
27
votes
6 answers
vimdiff disable/enable color coding
Is there any way to quickly disable/enable color coding in vimdiff ? The problem is, I have colored text in vim and the text is invisible is the text-color is Red, and the vimdiff too tries to put a background color of Red, making it hard to…
mtk
- 26,802
- 35
- 91
- 130
21
votes
4 answers
How to write the difference between two files into a file
Saying that I have two files: a.txt and b.txt.
The content of a.txt:
hello world
The content of b.txt:
hello world
something else
Of course I can use vimdiff to check their difference, I can make sure that a.txt is a subset of b.txt, which means…
Yves
- 3,161
- 7
- 26
- 54
21
votes
2 answers
vimdiff to compare output instead of files
I am trying to compare two command output (no files)
vimdiff "$(tail /tmp/cachain.pem)" "$(tail /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem)"
I tried playing with redirection, pipe, and vim - -c but I must be missing something. Can anyone…
Florian Bidabé
- 682
- 5
- 11
16
votes
7 answers
How to know if a text file is a subset of another
I am trying to find a way to determine if a text file is a subset of another..
For example:
foo
bar
is a subset of
foo
bar
pluto
While:
foo
pluto
and
foo
bar
are not a subset of each other...
Is there a way to do this with a command?
This check…
gc5
- 369
- 4
- 8
13
votes
1 answer
vimdiff / vim -d -- how to show only the differences and fold all identical lines?
Is there a way we can exclude the lines which are same in the below output? I did a vim -d file1 file2 but its showing the differences and also some additions lines before and after the differences. How to exclude that?
In the attached example 131,…
Sandosh Kumar P
- 347
- 1
- 5
- 14
12
votes
1 answer
Identify duplicate blocks of text within a file
Is there a convenient way to identify duplicate or near duplicate blocks of text within a file?
I want to use this for identifying code duplication. It looks like there are specialty programs with this capability but I'm not looking to get that…
Praxeolitic
- 1,638
- 3
- 18
- 24
10
votes
3 answers
Make vimdiff display different lines as different lines (not partially different)
vimdiff has an annoying habit of displaying two almost-completely-different lines as the same partially-different line just because they share a character in common at the beginning or end.
For example:
foo.txt contains: The quick brown fox jumps…
Shum
- 1,335
- 4
- 14
- 19
10
votes
2 answers
diff characterwise
Is there a stable tool (option/plugin of an existing tool: vimdiff, diff, etc) in Linux to do diff between two text files characterwise?
I would like to see the longest common subsequence between my two files highlighted. There is a classic…
Valentas
- 349
- 2
- 9
5
votes
4 answers
Comparing files with vimdiff from a script
I'm writing a script to compare two directories recursively and run vimdiff when it finds a difference:
#!/bin/bash
dir1=${1%/}
dir2=${2%/}
find "$dir1/" -type f -not -path "$dir1/.git/*" | while IFS= read line; do
file1="$line"
…
Big McLargeHuge
- 3,044
- 11
- 35
- 49
4
votes
1 answer
How can I see moved lines in a file comparison with vimdiff / diff?
Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead.
Like in this screenshot of Notepad++.
1.61803
- 1,201
- 2
- 15
- 23
4
votes
1 answer
How to disable vimplugins while invoking vimdiff command
I added few vim plugins like sytastic, nerdTree. They change the status line and other UI elements, which works fine while editing files.
But when I invoke vimdiff on 2 files, the nerdTree pane also open, the status lines are of no help. Is there…
mtk
- 26,802
- 35
- 91
- 130
2
votes
2 answers
Display git-diff between master and my last commit
I use git on a regular basis for collaboration with other people. When we work together on a shared repository, I'd like to be able to view the changes performed by others which happened between my last commit and the current master branch (or the…
n0542344
- 376
- 1
- 15
2
votes
1 answer
Display headers using vimdiff or vim -d
I have 2 tables which I need to compare and display the differences. I am able to do that using the following command:
vim -d table1 table2 -c :TOhtml -c :wqa
The problem I am facing is it's excluding the headers and captions when doing the…
Sandosh Kumar P
- 347
- 1
- 5
- 14
2
votes
1 answer
diff - showing changed lines in different section than inserted lines
(I'm running into this in a context of using vimdiff, which relies on and interprets the output of diff, so I think this is a diff question.)
Given these files, the first having 2 lines, the second having 4, diff (GNU 3.3) shows the complete…
user1902689
- 1,178
- 3
- 12
- 23
2
votes
1 answer
Vim and unified diffs
In my daily work, I only deal with unified diffs, so I would like to define the alias
alias diff='diff -puN'
in my .zshrc.
This alias is not respected when I use the shell from the vim command line mode, i.e., when I enter :!diff file1 file2. I…
Simon K.
- 23
- 2