Questions tagged [vimdiff]
The diff feature of vim lets show differences between two, three or four versions of the same file
127 questions
1
vote
3
answers
125
views
How can I avoid garish vimdiff change highlighting without going into deep vim voodoo?
I am but a simple man… I work on a black-background, light-gray foreground terminal, and I am a long-time, but in no way an expert, user of Vim. Disliking the default color scheme, many years ago I ...
1
vote
3
answers
124
views
Skip pattern in vimdiff
I often use diffthis to compare timestamped logs e.g. from dmesg. I would like to skip those timestamps when computing the diff so the two lines below are considered the same:
[ 0.003621] Early ...
1
vote
1
answer
185
views
How to jump to next modified (not added or removed) line in a diff?
:help jumpto-diffs gives commands to jump between changes in a vimdiff:
Two commands can be used to jump to diffs:
*[c*
[c Jump backwards to the previous start ...
0
votes
1
answer
627
views
AstroNvim in diff mode: navigating to next difference
In plain old (n)vimdiff, one can jump to the next/previous difference using [c or ]c respectively. (says :help diff documentation, at least)
Not so much in my AstroNvim; running nvim -d -R old.txt new....
1
vote
1
answer
183
views
Force TOhtml to generate a HTML output rather than a HTML5 output in Ubuntu 22.04.3 LTS
My python code opens a subprocess which in turn calls vimdiff and :toHTML.
Snippet added below:
subprocess.check_call(
[
"vimdiff",
...
1
vote
1
answer
117
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 | ...
1
vote
2
answers
219
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 ...
1
vote
0
answers
101
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 ...
0
votes
1
answer
115
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
1
answer
353
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=...
4
votes
1
answer
573
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
votes
1
answer
390
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
48
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 ...
4
votes
1
answer
976
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 ...
1
vote
1
answer
323
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 ...
0
votes
0
answers
73
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 ...
0
votes
0
answers
27
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 edit ...
2
votes
1
answer
818
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 ...
0
votes
1
answer
645
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 ...
2
votes
1
answer
409
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 ...
4
votes
0
answers
110
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 ...
4
votes
1
answer
1k
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 :...
2
votes
1
answer
242
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 ...
2
votes
0
answers
1k
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 ...
2
votes
1
answer
388
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?