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
0 votes
1 answer
18 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
11 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
14 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 ...
  • 105
0 votes
1 answer
30 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=...
  • 105
1 vote
0 answers
23 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
39 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
20 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
44 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
61 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
30 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 ...
1 vote
1 answer
73 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 ...
  • 11
4 votes
1 answer
404 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,443
0 votes
1 answer
83 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
28 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 ...
  • 165
0 votes
1 answer
336 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 ...
  • 175
0 votes
0 answers
32 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 ...
  • 318
1 vote
1 answer
496 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 ...
  • 175
1 vote
0 answers
37 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 ...
  • 349
2 votes
1 answer
214 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
151 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
196 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 ...
4 votes
1 answer
175 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
204 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 ...
  • 1,746
2 votes
1 answer
271 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 ...
  • 466
3 votes
0 answers
56 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 ...
  • 442
1 vote
1 answer
157 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,704
4 votes
1 answer
404 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
165 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
47 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
105 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
505 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
41 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
123 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?
2 votes
0 answers
91 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 ...
13 votes
2 answers
2k 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 ...
  • 133
5 votes
1 answer
1k 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 ...
4 votes
0 answers
152 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
95 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
144 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?
  • 221
3 votes
1 answer
238 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
257 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
65 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
1k 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
497 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
3 answers
584 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,911
1 vote
2 answers
1k 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, ...
  • 474
0 votes
0 answers
191 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,737
1 vote
0 answers
112 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 ...