Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [vimdiff]

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

3
votes
1answer
33 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
24 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
38 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-...
0
votes
0answers
16 views

Vimdiff causes command prompt to freeze with one particular file

I recently installed Vim for Windows (10) on my laptop and its mostly been working fine but, if I try to vimdiff with a text document I'm writing, it causes the command prompt to freeze. In general, ...
1
vote
1answer
77 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
45 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
176 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
36 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, ...
0
votes
1answer
311 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 ...
0
votes
1answer
122 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
61 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 ...
7
votes
2answers
640 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
100 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
0answers
173 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
72 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
138 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
258 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
216 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
378 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 ...
1
vote
0answers
142 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: |...
17
votes
2answers
5k 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 ...
9
votes
3answers
1k 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?
4
votes
2answers
119 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: +------------------+------------------+ | ...
5
votes
1answer
309 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
113 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 &...
0
votes
0answers
394 views

How to diffget from both sources?

I'm using fugitive and running Gdiff to merge files during git conflict. I have changes which I'm gonna save from current branch the same as merging branch. If I type diffget current branch, it will ...
1
vote
1answer
444 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 ...
2
votes
1answer
409 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
157 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 ...
0
votes
1answer
505 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 ...
1
vote
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?
0
votes
0answers
158 views

DirDiff 'there is no diff at the current line'

I'm trying to use DirDiff plugin for Vim. I installed the latest version with the help of pathogen. Then created two directories (dir1 and dir2) in /tmp. In each directory created file test (contents ...
3
votes
2answers
321 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
325 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 ...
5
votes
1answer
601 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
47 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 ...
4
votes
1answer
80 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
3answers
8k 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
814 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
449 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
1k 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 ...
1
vote
1answer
794 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
329 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
346 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....
5
votes
2answers
2k views

Git mergetool vimdiff command

I'm attempting to get something setup that invokes the vimdiff git merge tool externally, but because of the way the setup works, I need to invoke vimdiff manually (without git mergetool). Does anyone ...
2
votes
0answers
61 views

Mvimdiff launches with vertical split on far right

I'm trying to integrate mvimdiff into my workflow - but when I launch it via: git difftool <filename> I'm getting a wonky layout like this: _________________________ | | |...
3
votes
1answer
477 views

VimDiff incorrectly showing all lines as changed

I am using Vim with fugitive.vim plugin. Sometimes when diffing files versus their HEAD version from Fugitive's Gstatus window, Vim shows all lines in a file as changed, when in reality only one or ...
4
votes
1answer
1k views

Using Vim Diff To Create A Patch File?

I'm currently using vim 7.3 on Windows 7. The first question I have is it even possible to create the patch file from within vim itself? I understand the basic idea, but anytime I attempt to run ...
1
vote
1answer
105 views

Vimdiff does not read modeline

I have a modeline in a file # vim: set filetype=sshconfig : This sets filetype correctly in vim, but when opening the file in vimdiff, the filetype is set to conf. How can I tell vimdiff to read the ...
10
votes
1answer
1k views

Word level diffs in vim

As far as I understand the default vimdiff is doing only linewise diffs. However somtimes is useful to do word level diff, especially for text files like Markdown, LaTeX etc. There are some tools like ...