chrisbra / vim-diff-enhanced Goto Github PK
View Code? Open in Web Editor NEWBetter Diff options for Vim
Home Page: http://www.vim.org/scripts/script.php?script_id=5121
Better Diff options for Vim
Home Page: http://www.vim.org/scripts/script.php?script_id=5121
Is there anything that needs to be configured in order to get inline differences highlighted instead of the whole line?
I've tried with 'patience' and 'histogram' without success. My sample buffers are
first buffer:
test
second buffer:
this test;
The only caveat is that these buffers are not saved to any file... Would that make a difference?
I get E149: Sorry, no help for EnhancedDiff
.
Hi,
with Neovim 0.1.5 I get
The EnhancedDiff Plugin needs at least a Vim version 8.0
although it should have the same capabilities, right?
Hi Chistian,
I know this is going to sound like a stupid question, but I can't figure it out. How do I apply :PatienceDiff
on vim startup (so that when I run vimdiff, all my files get diffed with the patience algorithm)?
Putting PatienceDiff
in my .vimrc yields:
line 449:
E492: Not an editor command: PatienceDiff
While if I execute it after the file I loaded by typing :PatienceDiff
, everything works fine.
EDIT: I have made sure to put the PatienceDiff
invocation after loading the vim-diff-enhanced
plugin with Vundle.
Hi,
please make EnhancedDiffIgnorePat
take an additional argument to specify the replacement string to be used instead. I'd like to embed parts of the data, so simply using the optional argument in the replace call would be enough - it could then contain backreferences into the matched string like \1
.
Thank you!
CustomDiff fails on Win7 with gvim from vim.org (7.4.0) and cygwin git (2.1.1).
:CustomDiff histogram
EnhancedDiff: git diff Error executing "git diff --diff-algorithm=histogram -U0 C:/Users/davidb/AppData/Local/Temp/VIoEC75.tmp C:/Users/davidb/AppData/Local/Temp/VInEC76.tmp"
EnhancedDiff: fatal: Invalid object name 'C'.
(I get a similar failure with or without set shellslash
. I haven't figured out changing 'shell' to bash, but that might fix it.)
Looks like since the v:fname_in/out path names assume git will understand the same kinds of paths as gvim, but cygwin doesn't understand drive letters it all falls down. I'm not sure if there's something you want to fix (I should probably use msysgit, but it's too far removed from shell-useful).
I can work around it by making the paths relative (in ~/.vim/after/plugin/enhanceddiff.vim) with :cd $TEMP
:
if has('win32')
function! s:CustomDiffAlgComplete(A,L,P)
return "myers\nminimal\ndefault\npatience\nhistogram"
endf
command! -nargs=1 -complete=custom,s:CustomDiffAlgComplete CustomDiff :cd $TEMP | let &diffexpr='EnhancedDiff#Diff("git diff", "--diff-algorithm=<args>")'|:diffupdate
endif
Of course once I cd again (or immediately if I had autochdir enabled), then it's broken again.
due to let replace == 'XXX'
Hello,
This plugin allows to make use of the Patience diff algorithm for generating diffs to use with Vim.
Probably mean:
This plugin allows you to make use of the Patience diff algorithm for generating diffs to use with Vim.
You can also customize you setup
your setup
Is it really :CustomDiff histogram
or :EnhancedDiff <algorithm>
as mentioned further below?
Note: Those 2 commands use internally git to generate the diffs.
Probably needs revising. Are you saying git is used internally to generate the diffs?
Would be helpful if the readme had the patch check in it too when showing the new vim option:
if has("patch-8.1.0360")
set diffopt+=internal,algorithm:patience
endif
I believe the option should be "set diffopt+=internal,algorithm:patience" and
not "set diffopt+=internal,algorithm=patience"
Just installed the plugin and tried it inside a git repository with git difftool HEAD~2 HEAD~
. In the first file that I've tried :EnhacedDiff <any-algorithm>
, the diff style didn't change (tried many times), but when following for the next file in the changeset, the diff algorithm applied, nor did it get change for any of the following files in the changeset.
Vim 7.4.1016, Git 2.7.0. Using inside TMUX on Archlinux.
I have checked out a git repository. I created multiple worktrees for the same repository. When I try to use git diff from the non default git directory, vim diff and enhanced diff doesnt seem to work. Any fix?
Thanks
As an example, let the following two buffers:
When I run the following:
EnhancedDiffIgnorePat ^e.*
EnhancedDiff default
I would expect the first line to be ignored. But nothing changes in the buffers.
Whatever the expression I use, it does nothing.
The diff variable does have something in it:
g:enhanced_diff_ignore_pat [['^e.*' 'XXX']]
But whatever I do, it doesn't apply any filter. I also tried :diffupdate
, but it doesn't change anything.
Also the usage seems a bit clunky. Each time I run the command EnhancedDiffIgnorePat ^e.*
, I would expect the diff to update dynamically. Is it supposed to do that?
Overall, it seems like every command just does nothing. The only thing I've seen the plugin do in a consistent manner is the fact the variable g:enhanced_diff_ignore_pat
is updated after using the command EnhancedDiffIgnorePat
. Other than that, nothing works. May be I'm missing something in the doc? I don't see it.
Info
Plugin version: Version: 0.3 Thu, 05 Mar 2015 08:11:46 +0100
Git version: 2.32.0
Vim version:
VIM - Vi IMproved 8.2 (2019 Dec 12, compilé May 28 2021 06:58:52)
Rustines incluses : 1-2891
Compilé par Arch Linux
Énorme version avec interface graphique GTK3.
Fonctionnalités incluses (+) ou non (-) :
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm +tcl/dyn
-autoservername +folding +multi_byte +termguicolors
+balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
+browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl/dyn +title
+clientserver +job +persistent_undo +toolbar
+clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall +python/dyn +visual
+conceal +linebreak +python3/dyn +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localma
I tried this and tried a few "CustomDiff" algorithms and then did a "diffu", but didn't see
any changes in my diff window. It's possible it had something to do with my file choices, but
dunno. Also just noticed, I have "-w" set in my .vimrc file:
~/.vimrc:
let &diffopt+="-w"
I compared two ".h" files:
samplexity.h & samplexity.h.orig
Thanks!
(Attached)
PatienceDiff, DisableEnhancedDiff, CustomDiff, all have different prefixes. Plugins are more usable and discoverable if they namespace their commands, e.g.:
Ediff
EdiffPatience
EdiffDisable
EdiffCustom
...
C
, P
, D
, etc., the plugin only pollutes one prefix space: E
. wildmenu is less useful if each plugin creates a bunch of random non-namespaced command names.In the command definition <q-bang>
expands to "!"
and if "!"
evaluates to false.
We need either use if a:bang is "!"
or change <q-bang>
to <bang>0
I mean those packages with LTS distro versions, even CentOS 7, that don't support systemlist
.
Just a question.
I noticed in the images on the README, the filler lines look like they are using the –
character as apposed to the default -
character. Did you do anything special to achieve that?
Sorry for raising an issue to ask this. Didn't know how to ask otherwise.
Thanks
Hi! I have a setup whereby I diff many pairs of files in the same Vim buffer. The process goes more or less like this:
$ vim -"special diff mode" : $file1 $file2 : $file3 $file4 : ...
The "special diff mode" script basically opens every pair of files in a two buffers and puts them in diff mode. These files are immutable in my case.
I noticed that it's very slow for many pairs of files, so I used execsnoop(1)
. The following appears to be the "core" of diffing two files:
27327 /bin/zsh -c (git diff --diff-algorithm=patience -U0 /tmp/vWllDdr/71 /tmp/vWllDdr/72) >/tmp/vWllDdr/74 2>&1
27327 /bin/zsh -c (git diff --diff-algorithm=patience -U0 /tmp/vWllDdr/71 /tmp/vWllDdr/72) >/tmp/vWllDdr/75 2>&1
It seems at least one of those two is redundant (if tempfiles 71 and 72 are not changed in between, that is). I'm also not sure why /tmp/vWllDdr/71
and /tmp/vWllDdr/72
are used as sources at all. The real immutable files should be openable immediately. This might have something do with with the way this multi-buffer setup I mentioned above is done. The relevant part:
let s:idx = 0
while s:idx < argc()
if s:idx != 0
tabnew
endif
execute 'silent edit ' fnameescape(argv(s:idx))
execute 'silent ' s:vertical_modifier ' diffsplit ' fnameescape(argv(s:idx + 1))
wincmd =
let s:idx += 2
endwhile
Perhaps I'm doing something wrong here? Can I somehow mark those files as readonly when loading them into buffers such that vim doesn't attempt to make a copy?
Later I'll test with all of my plugins disabled, to see if there might be something else causing the duplication. I just wanted to collect my thoughts.
Another obvious way of speeding this up would be to run all of these things in parallel, but I don't think Vim supports such a thing.
Another possible source of slowness that I haven't benchmarked: starting a shell for every command (zsh -c
).
I'm running Ubuntu 14.04 with vim 7.4, patches 1-52 (the default from the Ubuntu 14.04 repo). I have git 2.3.2 installed. vim-diff-enhanced was installed with junegunn/vim-plug.
Running running :PatienceDiff
(or any other diff) results in the following error:
Error detected while processing function EnhancedDiff#Diff:
line 12:
E117: Unknown function: systemlist
E15: Invalid expression: systemlist(s:diffcmd. ' '. join(s:diffargs, ' '))
line 22:
E121: Undefined variable: difflist
E116: Invalid arguments for function empty(difflist) && difflist[0] !~# '^\%(\d\+\)\%(,\d\+\)\?[acd]\%(\d\+\)\%(,\d\+\)\?'
E15: Invalid expression: !empty(difflist) && difflist[0] !~# '^\%(\d\+\)\%(,\d\+\)\?[acd]\%(\d\+\)\%(,\d\+\)\?'
line 26:
E121: Undefined variable: difflist
E116: Invalid arguments for function writefile
E810: Cannot read or write temp files
E97: Cannot create diffs
It looks like systemlist
was added in vim 7.4.248, but that's not indicated as a requirement in the docs. Perhaps the best solution is to list the minimum vim version?
I've installed the plugin and when I try to run the test.sh script, it looks in ~/.vim/plugin
for the EnhancedDiff.vim file which, for me at least, actually exists in ~/.vim/bundle/vim-enhanced-diff/plugin
I don't know the general way to fix this as I don't know where all the other plugin managers might also stick the .vim file or I'd try to fix this myself and send you a pull request. Maybe you didn't mean for this to be used by other users?
Also, you've misspelled "readable" as "readabile" on line 27 of EnhancedDiff.txt.
Thanks very much for all your contributions to the vim world!
Could you add an algorithm that diffs moved lines?
I'm thinking Notepad++ Compare plugin. I haven't found a similar implementation for unix/linux in general, nor for vim
in particular.
I am use the latest vim-diff-enhanced. And use Plug to manage the plugins.
The error message when I run 'PatienceDiff' and any other commands in this plugin.
Searching for "/usr/local/google/home/hqian/.vim/plugged/vim-diff-enhanced/autoload/EnhancedDiff.vim"
chdir(/usr/local/google/home/hqian/.vim/plugged/vim-diff-enhanced/autoload)
fchdir() to previous dir
sourcing "/usr/local/google/home/hqian/.vim/plugged/vim-diff-enhanced/autoload/EnhancedDiff.vim"
finished sourcing /usr/local/google/home/hqian/.vim/plugged/vim-diff-enhanced/autoload/EnhancedDiff.vim
calling function EnhancedDiff#Diff
calling function EnhancedDiff#Diff..<SNR>166_DiffInit
calling function EnhancedDiff#Diff..<SNR>166_DiffInit..<SNR>166_ModifyPathAndCD
function EnhancedDiff#Diff..<SNR>166_DiffInit..<SNR>166_ModifyPathAndCD returning '/tmp/vCmMcn3/39'
continuing in function EnhancedDiff#Diff..<SNR>166_DiffInit
calling function EnhancedDiff#Diff..<SNR>166_DiffInit..<SNR>166_ModifyPathAndCD
function EnhancedDiff#Diff..<SNR>166_DiffInit..<SNR>166_ModifyPathAndCD returning '/tmp/vCmMcn3/40'
continuing in function EnhancedDiff#Diff..<SNR>166_DiffInit
function EnhancedDiff#Diff..<SNR>166_DiffInit returning #0
continuing in function EnhancedDiff#Diff
Calling shell to execute: "(git diff --diff-algorithm=patience -U0 /tmp/vCmMcn3/39 /tmp/vCmMcn3/40) >/tmp/vCmMcn3/42 2>&1"
calling function EnhancedDiff#Diff..<SNR>166_ModifyPathAndCD
function EnhancedDiff#Diff..<SNR>166_ModifyPathAndCD returning '\-'
continuing in function EnhancedDiff#Diff
calling function EnhancedDiff#Diff..EnhancedDiff#ConvertToNormalDiff
function EnhancedDiff#Diff..EnhancedDiff#ConvertToNormalDiff returning []
continuing in function EnhancedDiff#Diff
function EnhancedDiff#Diff returning #0
E97: Cannot create diffs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.