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
3
votes
1answer
241 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
302 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 ...
3
votes
1answer
816 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
821 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. ...
4
votes
2answers
1k 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
299 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: |FilterWritePre|...
43
votes
4answers
23k 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 ...
14
votes
3answers
5k 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
224 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
1k 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
175 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 &...
2
votes
1answer
902 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
1k 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
366 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 ...
2
votes
1answer
911 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 ...
4
votes
1answer
5k 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
767 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
678 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 ...
13
votes
1answer
2k 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
67 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
110 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 ...
23
votes
4answers
15k 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
2k 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
669 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 ...
3
votes
1answer
2k 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
729 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 ...
1
vote
3answers
743 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....
8
votes
2answers
3k 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
89 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: _________________________ | | |...
4
votes
1answer
1k 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 ...
5
votes
1answer
2k 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
143 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 ...
13
votes
1answer
3k 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 ...
2
votes
1answer
1k views

Navigate to first diff in diff mode on startup?

Vim diff opens 2 files for diffing, but it doesn't navigate to the first diff section automatically on startup. Can I add something to startup script (like _vimrc) to do this?
1
vote
2answers
542 views

How to set both files to the encoding in vim diff from command line?

I've opened the files I want to diff using the following command: C:\temp\robocopyTasks>vim -c "edit ++enc=ucs-2le" -d C:\temp\robocopyTasks\acl\tasks_temp.txt C:\temp\robocopyTasks\acl\tasks_win....
2
votes
1answer
173 views

Vim Diffing a pair of Unicode little endian without BOM text files in a readable format?

I have a pair of "Unicode little endian without BOM" text files that I would like to diff each other via the command line. Unfortunately when I open them using the command line in vim for Windows ...
1
vote
1answer
4k views

How to split window directly from command line? [duplicate]

I'm using Ubuntu system. I have files: A.txt, B.txt, C.txt I can split window in the following way: vim A.txt :vs B.txt // after entering into vim :vs C.txt Is there any way to achieve the same ...
5
votes
1answer
8k views

Modify vimdiff highlighting

For readability I try to modify my ~/.vimrc to get some proper highlighting. I found here to use e.g. this: highlight DiffChange cterm=none ctermfg=fg ctermbg=Red gui=none guifg=fg guibg=Red Like ...
3
votes
2answers
479 views

Highlight longest common subsequence between two files? line by line

I'm asking about some sort of specialized diff highlighting mode. I need to diff, line by line, files A and B, which look similar to this in vimdiff: A B repo/manipulate_1....
9
votes
2answers
2k views

Create mappings that only apply to diff mode

In my vimrc I have <C-H>, <C-J>, <C-K> and <C-L> mapped to navigate between split windows in normal mode. When I use diff mode I only ever have windows in vertical splits, so ...
2
votes
2answers
876 views

c:\Program is not recognized error while running vimdiff

I use windows XP for testing and running some programs. I installed Vim on the machine, but when I run vimdiff on two files, I get the following error: '""C:\Program' is not recognized as an internal ...
33
votes
3answers
16k views

In Vimdiff, how do I switch the left and right panes?

When I do vimdiff file2 file1, file2 naturally goes on the left and file1 on the right. Sometimes I find that I put them the wrong way round, so I'd like to be able to switch them round without ...
46
votes
5answers
25k views

How to diff and merge two directories?

I know that Vim's diff mode (vimdiff) allows us to compare the contents of two (or more) files. But it is possible to compare content of multiple files across directories in order to merge two ...
7
votes
1answer
758 views

How can I suppress the "press enter" prompt when opening files in diff mode?

When using gVim (on Windows; see below) to diff two files which both have very long paths relative to the current working directory, the dreaded "press enter" prompt appears during load, before ...
6
votes
1answer
815 views

diffoff on all buffers

Occasionally I have a stray forgotten buffer in which I ran :diffthis. Later when I run :diffthis on some unrelated buffer that second buffer is immediately and unintentionally highlighted with the ...
14
votes
1answer
3k views

vimdiff and merge conflicts

When merging branches under source control there is often the issue of a merge conflict with other developers. I know that we can use vimdiff to diff code changes against source control, but is there ...
162
votes
8answers
219k views

How do I use vim as a diff tool?

I use vim as my primary editor. I would also like to use vim to diff files and modify the files while doing the diff to fix easy changes (rather than most diff techniques which are a cycle of diff/...
17
votes
1answer
3k views

More detailed comparison within a line

I use vimdiff to inspect differences between files, and some times it misses out a bit. for example, if I have the following two files: //a.c printf("Hello\n"); and: //b.c int i = printf("hello\n") ...
24
votes
2answers
7k views

Make panes resize when host window is resized

I like to use vimdiff as a git diff/merge tool. The problem is when I resize the host terminal window to a new size: of the two split panes, the leftmost remain of the same width, while the rightmost ...

1
2