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
1 answer
143 views

How do I change the color of the deleted text on the left side of a vimdiff?

My colors currently look like this, with the text highlighted green on both sides: I would like it to be red on the left, and green on the right. I tried to change the DiffDelete highlight, but that ...
vinnydiehl's user avatar
1 vote
1 answer
59 views

DiffOrig, but show the patch

Vim help suggests a nice command to show a side-by-side diff of the current buffer since the last save: command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ \ | diffthis | wincmd p | ...
Canis Lupus's user avatar
2 votes
1 answer
176 views

How to diff the current text and the clipboard?

How to create a diff of the current text and the clipboard? It could result in a vertical split showing the clipboard content, and a normal diff between them. Opening a vertical split, pasting and ...
Volker Siegel's user avatar
1 vote
2 answers
63 views

vimdiff to operate on only the cursor line

If I have a block of contiguous flagged lines in vimdiff, then it treats them as if they were a single diff, and pressing 'dp' sets the other buffer the same for the entire block. Is it possible to ...
workisa4letterword's user avatar
0 votes
1 answer
61 views

Detect when a diff begins and ends?

How can I detect when a diff begins and ends? By "diff" I mean when at least 2 buffers are in diff mode (i.e. they are scroll-bound and diff syntax highlighting is visible). I'm not asking ...
Steve Ward's user avatar
1 vote
0 answers
78 views

How can I highlight the line number with diffadd and diffadd and diffdelete

I want line numbers to be highlighted for diff files depending on added lines and removed lines. For added lines, the line number should be green. For removed lines, the line number should be red. I ...
Amarakon's user avatar
  • 261
1 vote
0 answers
50 views

How can I diff two files from different start positions? [duplicate]

In an editing session I have 2 buffers in 2 windows. I would like to compare a part of file 1 with a part of file 2. The normal way is to use :diffthis in the two buffers. But the comparison begins ...
Anton Wessel's user avatar
0 votes
1 answer
56 views

Remap 'diffget' and disable the binding to 'do'

Since the keys o and p are close and sometimes I mistype them. I would like to remap diffget and disable do.
Arch Stanton's user avatar
0 votes
1 answer
41 views

How to enforce a specific order for the windows opened by diffsplit?

Calling diffsplit {filename} opens the new file at the top and the current file at the bottom. Similarly, the vertical version opens the new file on the left and the current file on the right. Is it ...
Matt's user avatar
  • 177
0 votes
1 answer
159 views

How to change editor options when switching to diff mode?

I have a few options I like to apply both when Vim is opened in diff mode and when it is switched to diff mode, e.g., when calling diffsplit. I have the following lines in my ~/.vimrc: command! -nargs=...
Matt's user avatar
  • 177
2 votes
0 answers
214 views

vim-fugitive support for diff --color-words

I use vim and git primarily for editing prose documents in LaTeX or Markdown, not for coding. For this reason, my go-to git diff command is git wdiff, where the relevant part of .gitconfig reads ...
Alex Roberts's user avatar
4 votes
1 answer
302 views

git config does not set vimdiff layout properly

I'm trying to configure vimdiff as a git merge tool, so my global git config contains the following lines: [merge] tool = vimdiff conflictstyle = diff3 prompt = true [mergetool "...
gigoQ's user avatar
  • 43
0 votes
1 answer
147 views

vim mapping diffput / diffget to Ctrl+Left / Ctrl+Right with working buffer selection from count

Pretty new to mappings in Vim, In Diff Mode I've got C-Up and C-Down mapped to [c and ]c for diffjumping. I'm wanting to map C-Right and C-Left to :<C-U>diffput v:count<CR> and :<C-U>...
Jack T's user avatar
  • 1
3 votes
1 answer
251 views

What's the `//2` in `:diffget //2`

I read "the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names" from here. Exactly what are those identifiers, and does :diffget //2 work for ...
Gordon Bai's user avatar
0 votes
0 answers
100 views

vimdiff and numbers of diffs

Suppose I have two files such as : vimdiff file1.txt file2.txt How to find out numbers of differences in the given files?(with hot key or another way)
PersianGulf's user avatar
0 votes
0 answers
27 views

Is it possible to fix a section of buffer fixed on top even when scrolling?

I need to open 4 different files on my screen to consolidate data on diff file . I kept forgetting which tile is which file.. All my files has file name on line 1.. Is there way to keep the line 1 ...
purityKEF's user avatar
2 votes
1 answer
288 views

How can I view a diff for a single file from a diff file with multiple files?

I have a diff file generated by git diff HEAD~2 > alldiff. Is it possible to view the diff for any one file using alldiff? For example, somecmd alldiff file1withchanges will use alldiff to show ...
Atul's user avatar
  • 21
4 votes
1 answer
744 views

Is it possible to use vimdiff's side by side view with a regular diff file?

Given a patch (without having both files, e.g.) git show -c > some_patch.c, is it possible to view this patch in vimdiff with a side-by-side view? Or does this require having both source and ...
ideasman42's user avatar
  • 3,683
0 votes
1 answer
139 views

Automatically getting diff between netrw preview window and fixed file

Say I am in a directory with the filetree below, where gold.txt is a file I would like to compare each of the other .txt files against, one at a time. . ├── gold.txt └── to-compare ├── compare1....
postylem's user avatar
  • 103
1 vote
1 answer
124 views

Diff buffer with disk file -- understanding the output tab/windows

I use the solution provided here, reproduced below: function! s:DiffWithSaved() let filetype=&ft diffthis vnew | r # | normal! 1Gdd diffthis exe "setlocal bt=nofile bh=wipe nobl ...
Tryer's user avatar
  • 247
0 votes
1 answer
966 views

How to diff a selected part of two files?

I have two files with some similar program functions in. But these functions are not ordered File 1: | File 2: function a | function c | function b | function e ...
Andy A.'s user avatar
  • 215
0 votes
0 answers
51 views

How to export the current tab (with every window in it) with TOhtml without them being part of diffs?

I know that when doing a diff, and issuing TOhtml, it will export the entire tab into HTML. How can one do the same without those windows in the tab not being diffed? :help TOhtml shows all the ...
toraritte's user avatar
  • 400
1 vote
1 answer
1k views

How to disable scrollbind and cursorbind after using vimdiff?

I have this issue where I need to both compare files, which I do using vimdiff, but also work on individual files with vertically split screens (vs). However, after I call vimdiff on a file, opening ...
mivkov's user avatar
  • 113
0 votes
0 answers
22 views

How can I edit a file and show a diff in a vertical split pane [duplicate]

I have a program file prog.pl and a backup prog.pl-20210615. At first they are identically. But then I want edit prog.pl and see the differences to the backupfile prog.pl prog.pl-20210615 text to ...
Andy A.'s user avatar
  • 215
1 vote
0 answers
74 views

How to integrate GCC's fix-it hints into a vim-based workflow?

Modern GCC provides the -fdiagnostics-generate-patch flag: Options to Control Diagnostic Messages Formatting [...] -fdiagnostics-generate-patch Print fix-it hints to stderr in ...
PiCTo's user avatar
  • 359
2 votes
1 answer
483 views

How to select multipe files for vimdif using netrw?

Suppose I have some files in a folder. I browse the folder using vim vim myfolder. It opens netrw with a list of the files in the directory. Now I want to select two or more files and then open them ...
Ahmad's user avatar
  • 165
2 votes
2 answers
295 views

Can I use vimdiff to open diff unified files?

I have the file1.txt with this content Once upon a time, there was a girl named Persephone. She had black hair. She loved her mother more than anything. She liked to sit outside in the sunshine with ...
Ziggoto's user avatar
  • 21
0 votes
1 answer
315 views

How can I search only actual differences in vimdiff?

Basically I need to search only in areas marked red, not pink (in the default color scheme). All I can find is how to search the unfolded areas. This is not very useful to me. I have long lines which ...
n. m. could be an AI's user avatar
4 votes
1 answer
395 views

Vimdiff line count of different lines

is there a way to number the lines that are different in vimdiff? Is there a way to count the lines that are different in vimdiff?
cokedude's user avatar
  • 141
2 votes
1 answer
294 views

Mapping specific for diff mode and vimdiff

My idea is that whenever &diff is true for a buffer, I would like some mappings to be active when that buffer is the current buffer. The following attempt works for when I open a session in diff ...
Enlico's user avatar
  • 2,172
3 votes
1 answer
563 views

Can vimdiff for git diffs be started in tab of current process?

Let's say I have a file buffer open and a :terminal split open in 1 tab page. I'd like to create a new tab where I run vimdiff but have my git diff showing. I'm trying to get git difftool HEAD~1 to ...
425nesp's user avatar
  • 566
4 votes
0 answers
76 views

Can diff mode empty lines be utilized outside diff mode?

In diff mode, deleted lines are indicated by a colored block (green below). The 'number' line numbers are skipped for this block. Is it possible to emulate this behavior (screen-width colored blocks ...
dannyadam's user avatar
  • 482
3 votes
1 answer
324 views

How do I diffput a deleted line?

When viewing a diff of two files in Vim, you can put changes from the source file to the destination file by pressing d then p, or by running :diffput. However, this doesn't work if the change is a ...
Flimm's user avatar
  • 2,182
4 votes
1 answer
728 views

Turn syntax off only for current buffer/window?

Is there a way to turn off syntax for only the current buffer/split windows? like for example, you can set map <buffer> or setlocal. Is there something similar for the syntax option ? I use the :...
First User's user avatar
1 vote
0 answers
336 views

Turn syntax highlighting off in diff mode when started within vim?

I would like syntax to be turned off when I am in diff mode to focus only on the differences. I have the following code in my vimrc which works only when I start vim in diff mode from the command line ...
First User's user avatar
2 votes
1 answer
84 views

Required to write gvimdiff file1 ..\..\..\file2 to diff correctly

I'm trying to diff two files using gvimdiff file1 file2. This works in certain parts of my file system, but if I'm several directories deep, it stops working. Instead, it'll open three files and one ...
JDG's user avatar
  • 221
1 vote
0 answers
175 views

Is it possible to do a reverse vimdiff

There are many answers like this which talk about reversing the search results in one vimbuffer. But I am wondering if there is way to highlight matching lines only in vimdiff. Something like ...
PHcoDer's user avatar
  • 111
2 votes
0 answers
766 views

Vimdiff : highlight line numbers differently

I use relative line numbers thanx to the following settings in my vimrc: set number set relativenumber Since I don't want to wrap lines in diff mode, it's sometimes hard to tell which line include a ...
Dupond's user avatar
  • 45
1 vote
0 answers
74 views

Is it possible to use Vim's power (Vim buffers...) while doing 3 way merge in Meld?

Is it possible to use Vim's power (Vim buffers...) while doing 3 way merge in Meld ? I can see in Meld you can change the default editor: edit -> Preferences -> Editor -> default editor I ...
HarshaD's user avatar
  • 111
2 votes
1 answer
204 views

Any difference between vimdiff and vim -d?

Are there any differences between using vimdiff x.py y.py and vim -d x.py y.py?
WalksB's user avatar
  • 497
2 votes
0 answers
133 views

Lock the first line when doing diff between two files in vimdiff

I am trying to do a diff between a couple of csv files. I have performed column -t -s"," on both the files to be able to compare better. The first row contains the column names and I want to lock it ...
New to Rails's user avatar
20 votes
2 answers
5k views

How do I enter into vimdiff mode given two splits are already open?

I know you would normally enter into vimdiff mode from the terminal with vimdiff file1 file2. However, I frequently find myself already in vim with multiple different splits, and I'd like to run ...
Aeroblop's user avatar
  • 303
5 votes
1 answer
2k views

IDE-like inline diff highlighting in Vim

I enjoy using Vim and like it better than IDEs on most points. One common IDE feature that I miss, though, is inline diff highlighting: In this example changed lines are highlighted in blue and ...
August Janse's user avatar
5 votes
0 answers
220 views

VIMDIFF missing small differences

I have two nearly identical very large files (890,000+ rows of exactly 899 characters each fixed length file). On rows 289141-289148 one file has a pipe character in column 38, and the other file has ...
PeterBSmith's user avatar
1 vote
1 answer
150 views

How vimdiff links to vim

When i do a ls -l /usr/bin/vimdifff it shows following /usr/bin/vimdiff -> vim Does this mean vimdiff and vim are the same? I know that we can use vim for diff by giving -d. But how does linking ...
BAdhi's user avatar
  • 113
0 votes
1 answer
199 views

vimdiff: disable option iwhiteeol in diffopt

I want to see trailing white space differences using internal diff. By default vim uses iwhilteeol. Is there a way to turn this option off?
Konstantin Glukhov's user avatar
3 votes
1 answer
270 views

If one can diff from Vim without the need to boot `vimdiff` then why is it a binary program?

Before you start reading. Before having answers, I thought vimdiff was a binary program because I'm used to Debian's file, which seems not to honor POSIX (but I didn't knew); but then I used macOS 10....
13260's user avatar
  • 79
1 vote
2 answers
398 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 ...
ceinmart's user avatar
  • 121
2 votes
0 answers
71 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 ...
Wayne Werner's user avatar
1 vote
1 answer
2k 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) ...
Pie's user avatar
  • 175