Questions tagged [vimdiff]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
35 views

How to run Vim Diff without enter in interctive mode?

I really like the vimdiff / vim -d , it's awesome. But I need to see the vimdiff result without enter in the interactive mode. Show the result colored , scrolling all differences and exit. Behave ...
2
votes
0answers
55 views

Is there a better way to diff from a patch?

Background: I'm working on a large project that has some disparate coding styles. I'm working on unifying that but only the parts that I've most recently touched. The tool that I'm using produces a ...
0
votes
1answer
51 views

`vimdiff` nor `nvim -d` are working as an external diff tool for git

First line says output is not a terminal. The rest of the output looks like term codes aren't being processed. I use st, with $TERM = st-256color. I just tried it on termite ($TERM = xterm-termite) ...
0
votes
0answers
21 views

How to place signs over signcolumn manually according to vimdiff

What I want is kind of like vim-gitgutter. But there are some specific differences: I want it to be enabled in only diff mode, even outside git directories I want it to show signs on both/all the ...
0
votes
2answers
46 views

Vimdiff: Is there a way of knowing if there are differences in the diff files or not?

I am trying to find (in Vim script) if the 2 files open using vimdiff are same or different? Is there a way to do that? (a variable like &diff perhaps?)
0
votes
3answers
67 views

Find duplicate entries in two different lists

I have two different lists of words and I want to make sure that they have no mutual duplicates. In other words, none of the words in list A can be in list B and vice versa. They must be mutually ...
1
vote
2answers
133 views

Show changes since buffer was opened

Is it possible to show all changes made to a buffer since the buffer was opened? This question https://stackoverflow.com/questions/749297/can-i-see-changes-before-i-save-my-file-in-vim is related, ...
0
votes
0answers
54 views

make vim produce patch files without editing originals

I want to edit text files with vim, I would love vim file.txt To work like normal, and open file.txt in vim, like normal, and allow me to edit it seemingly like normal. The only difference is, all ...
1
vote
0answers
60 views

How to diff/edit two versions of the same file with vim? [duplicate]

I need to repeat the following workflow multiple times: I have a repository with two branches I need to work simultaneously with two revisions of the same file, each revision belonging to one of the ...
3
votes
1answer
56 views

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 ...
1
vote
0answers
42 views

“diff”-ing current with “earlier” time

I have a file opened and I know I can do :diffsplit to open the file in a diff view. I also know that I can do something like :earlier 30m to see how the file was 30 minutes ago. My question is: how ...
0
votes
1answer
106 views

How to compare two different Vim installs?

Basically, I want to compare which features were enabled when each installation of Vim was compiled. If there's also other significant differences between the two installations, besides their feature-...
1
vote
1answer
202 views

diffpatch using the output of git diff directly

I guess many of you are like me, and even if they have been using ViM for years, still learn new features regularly. The last that I learned was :diffp[atch] patch/name Now, I want to combine it ...
0
votes
1answer
172 views

How can I see which buffers are in diff mode?

:ls shows my buffers and lists flags for each buffer, but doesn't list whether &diff is set. Plugins like unite's buffer source just rely on :ls output. Is there an easy way to list and manage ...
0
votes
1answer
726 views

Visualize git commit diff similarly to mergetool

I've been thinking of ways to visualize git commits with vim. I would like to be able to: run a command from the terminal such as: vimdiff -c <commit id>. vim opens with two windows on a ...
1
vote
1answer
54 views

How can I determine if *any* window in the current tabpage is in diff-mode?

So, I found this useful answer about iterating buffers; but due to the tabpage-specific duality of windows in Vim, I failed at adapting it to my needs. Thus: how can I construct a boolean expression, ...
1
vote
1answer
488 views

How to use pure Vim as git mergetool?

Whenever there are some git merge conflicts we would type git mergetool and git would automatically launch a merge tool for us to merge the conflicts. I have been using vimdiff for a long time as my ...
1
vote
1answer
289 views

How to apply patch to a buffer in place?

I want to use yapf to reformat parts of python buffers. Yapf can take input from stdin yapf -l 30-40. This would produce output that is the whole buffer but with lines 30-40 reformatted. I can then ...
0
votes
1answer
171 views

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 ...
8
votes
2answers
881 views

How do I differentiate between vim and vimdiff from within vimrc?

I have a function in vim which will open all buffers as tabs. However after I add this function, vimdiff too opens the files to be compared as different tabs and hence doesn't show the differences. Is ...
1
vote
1answer
187 views

How to customize the color of an HTML output file generated from Git Bash?

I have used the following command in Git Bash to perform a 'vimdiff' for 2 XML files. vimdiff xml1.xml xml2.xml -c TOhtml -c 'w! result.html' -c 'qa!' The HTML file which is getting generated is ...
1
vote
1answer
335 views

How to make gvimdiff works under MobaXterm or cygwin?

I am using Mobaxterm which has cygwin tools. vim/gvim are working fine. I am using same vimrc file for both (with -u option). Note that I have same issue without any vimrc file. To make vimdiff ...
3
votes
1answer
105 views

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 ...
2
votes
2answers
200 views

Diffsplit with output of external command in Vim?

I know I can enter diff mode in vim by calling diffsplit <filename>. I also know I can call an external command and replace the file contents with its output (e.g. in this answer someone uses ...
1
vote
1answer
404 views

How to set colorscheme of vimdiff using .vimrc

I want to set colorscheme during vimdiff at startup. Note this colorscheme would be different than Vim's colorscheme.
2
votes
1answer
383 views

Automatically disable cursorline when in diff mode?

I typically use set cursorline by default and it works reasonably well with my preferred color schemes (molokai, vividchalk, moonfly). In normal mode. In diff mode, it almost always screws things up. ...
3
votes
2answers
584 views

How to start Vimdiff without equal sections folded?

I'd like vimdiff to start with all the folded sections opened. So far I have tried the following: vimdiff -c "set nofoldenable" -R <(tree -d directory1) <(tree -d directory2) with the -c "set ...
2
votes
0answers
216 views

How to execute a function when a diff closes

I have a setting (namely highlight the 81st character on the line) that I would like to turn off when there is a diff. This is easy enough as a search through the autocmds results in: |...
21
votes
2answers
8k views

How do I customize vimdiff colors?

I am trying to use vimdiff as my git merge tool, but the colors used are making it unbearable (at least on Windows/Mingw): the background color and the foreground color is the same for some of the ...
10
votes
3answers
3k views

Is there a way to “take both” when using Vim as merge tool?

I'm using Vim as a 3-way merge too with Git and sometimes need to take changes from both local and remote branches. kdiff3 can do this with a couple of key presses, is there a way to do this in Vim?
3
votes
2answers
168 views

Two seperate diff sessions on one screen

I would like to compare File1-v1.txt with File1-v2.txt and File2-v1.txt with File2-v2.txt at the same time. I tried to create the following layout: +------------------+------------------+ | ...
4
votes
1answer
516 views

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 ...
1
vote
0answers
141 views

diff or vim -d colorscheme [duplicate]

I need a readable colorscheme for vim -d (or vimdiff). My problem is that some lines aren't readable (see picture), white text on yellow background: I tried also the following in ~/.vimrc: if &...
1
vote
1answer
600 views

Diff more than 4 buffers at the same time

I often want to diff more than 4 files, but I run into E96: Can not diff more than 4 buffers. This limit seems to be compiled into vim, and it also seems rather arbitrary. Is there anything I can do ...
3
votes
1answer
667 views

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?
2
votes
1answer
242 views

Stop vim from removing whitespace on save for diff files

I am currently trying to edit a git hunk file (a diff: .git/addp-hunk-edit.diff), and to say to git that a line containing whitespace is unchanged it needs to have (a line with a single space) as its ...
1
vote
1answer
700 views

vim diff isn't working while my shell is powershell

My settings for shell are: set shell=powershell\ -ExecutionPolicy\ Unrestricted\ -NoProfile\ -NoLogo\ -NonInteractive set shellcmdflag=-Command And when i'm using that, I'm getting following error ...
3
votes
1answer
2k views

Using vim diff to compare the working directory to the HEAD in git?

Is it possible to use vim diff to open and compare all the differences between HEAD and the files in the working directory?
3
votes
2answers
422 views

Make vim switch to other window after opening a diff

99% of the time when I am opening a diff (using the :diffsplit command), it's because I want to reference some code, but still edit the file I started in. However, whenever you open a diff with ...
8
votes
1answer
480 views

Move to next unmatched line with vimdiff

Is there a way to move to the next unmatched line with in vimdiff? Not "move to the next changed line", but move to the next unmatched line for the current file. In my case I'm trying to compare two ...
7
votes
1answer
1k views

Turn off synchronous scrolling not caused by either scrollbind or diff

I have a file that has decided to scroll synchronously when I open it in a second window and start scrolling. scrollbind and diff are set to off. (:set scrollbind? prints noscrollbind and :set diff? ...
3
votes
0answers
59 views

The way to imrove vimdiff similarity-searching mechanism

I'm trying to understand how vimdiff work. Here I tried to diff two simple files. The 1st: abcdefghijklmnopqrstuvwxyz foo abcdefghijklmnopqrstuvwxyz iii bar The 2nd: abcdefghijklmnopqrstuvwxyz ...
3
votes
1answer
88 views

vimdiff marks wrong line as added when first line in change is new

When the first line(s) in a change are new/added, and subsequent lines are changed, Vim marks the first lines as changed up the number of lines occupied by the original lefthand file, and the ...
20
votes
4answers
10k views

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 ...
16
votes
2answers
1k views

How to make the two windows equal width when comparing files?

How to make the two windows equal width when comparing files with command vim -d file1 file2? How to make the two windows be equal width?
2
votes
1answer
522 views

How to use ~/.vimrc for vimdiff

How can I get git's difftool, when using vimdiff, to use my ~/.vimrc file?
5
votes
1answer
2k views

Overwrite colorscheme syntax highlighting

/* This is coming directly from Molokai's issue #36. */ The problem Molokai is a very nice theme for Vim but it has a terrible vimdiff highlighting (see left split, last 5 lines). + are not green ...
2
votes
1answer
1k views

Undo diffget in vimdiff

Say I have a merge conflict in Git, and try to resolve it with vimdiff using diff3 view. Here is a screenshot: Now while resolving, I want to diffget once from LO see how it looks like, undo, and ...
2
votes
1answer
408 views

Can vimdiff show large files beyond screenful limits at once?

I'd like to diff large files in vim using the scrollback limit set in my terminal (which is available memory), so I can, if necessary, find and review previously applied changes. I use OS X's ...
0
votes
1answer
420 views

How to start vimdiff in Vertical mode?

Size of one file is 200 Mb, while the size of another file is 20 Mb. I need to press ctrl+c to stop loading the big file, when no vimdiff mode is enabled although I run: vimdiff <(hexdump -C r328....