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
2 answers
34 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 ...
0 votes
1 answer
51 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 ...
1 vote
0 answers
69 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 ...
  • 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 ...
0 votes
1 answer
27 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.
0 votes
0 answers
17 views

BufReadPre only with vimdiff OR regex to ignore

I am trying to ignore hardcoded line numbers when running vimdiff on files. The regex ^\s*\d\+: properly identifies all the line numbers (which are only on some lines, not all lines). So far I've ...
0 votes
1 answer
26 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 ...
  • 145
0 votes
1 answer
66 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=...
  • 145
1 vote
0 answers
113 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 ...
0 votes
1 answer
111 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 "...
  • 3
0 votes
0 answers
36 views

vimdiff three files not showing some differences

I created three simple files with lists of numbers and did vimdiff f1 f2 f3 and got this as a result: 1 | 1 | 1 2 | ...
0 votes
1 answer
75 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>...
  • 1
2 votes
1 answer
109 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 ...
0 votes
0 answers
49 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)
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 ...
2 votes
1 answer
141 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 ...
  • 21
4 votes
1 answer
599 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 ...
  • 3,583
0 votes
1 answer
106 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....
  • 103
0 votes
1 answer
45 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 ...
  • 207
0 votes
1 answer
587 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 ...
  • 207
0 votes
0 answers
39 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 ...
  • 368
1 vote
1 answer
739 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 ...
  • 113
0 votes
0 answers
20 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 ...
  • 207
1 vote
0 answers
47 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 ...
  • 359
2 votes
1 answer
304 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 ...
  • 165
2 votes
2 answers
189 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 ...
  • 21
0 votes
1 answer
240 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 ...
  • 123
4 votes
1 answer
264 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?
  • 141
2 votes
1 answer
236 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 ...
  • 2,014
2 votes
1 answer
400 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 ...
  • 516
4 votes
0 answers
63 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 ...
  • 462
1 vote
1 answer
214 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 ...
  • 1,972
4 votes
1 answer
530 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 :...
1 vote
0 answers
234 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 ...
2 votes
1 answer
55 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 ...
  • 221
1 vote
0 answers
126 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 ...
  • 111
2 votes
0 answers
622 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 ...
  • 45
1 vote
0 answers
47 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 ...
  • 111
2 votes
1 answer
149 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?
  • 447
2 votes
0 answers
113 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 ...
16 votes
2 answers
3k 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 ...
  • 163
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 ...
5 votes
0 answers
181 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 ...
1 vote
1 answer
121 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 ...
  • 113
0 votes
1 answer
166 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?
3 votes
1 answer
250 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....
  • 79
1 vote
2 answers
331 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 ...
  • 121
2 votes
0 answers
67 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 ...
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) ...
  • 175
0 votes
2 answers
564 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?)