Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Vim Gitgutter | 8,128 | 15 days ago | mit | Vim Script | ||||||
A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks. | ||||||||||
Vim Signify | 2,607 | 2 months ago | 12 | mit | Vim Script | |||||
:heavy_plus_sign: Show a diff using Vim its sign column. | ||||||||||
Git Messenger.vim | 1,161 | a year ago | 12 | mit | Vim Script | |||||
Vim and Neovim plugin to reveal the commit messages under the cursor | ||||||||||
Gitv | 924 | 4 years ago | 16 | Vim script | ||||||
gitk for Vim. | ||||||||||
Committia.vim | 580 | 2 years ago | 8 | mit | Vim script | |||||
A Vim plugin for more pleasant editing on commit messages | ||||||||||
Linediff.vim | 431 | 14 days ago | 4 | mit | Vim Script | |||||
A vim plugin to perform diffs on blocks of code | ||||||||||
Vim Diff Enhanced | 332 | 3 years ago | Vim script | |||||||
Better Diff options for Vim | ||||||||||
Diffconflicts | 323 | a year ago | bsd-3-clause | Vim script | ||||||
A better Vimdiff Git mergetool | ||||||||||
Vim Dirdiff | 302 | 4 months ago | 18 | Vim script | ||||||
Vim plugin to diff two directories | ||||||||||
Vim Autopep8 | 243 | 3 years ago | 6 | mit | Vim script | |||||
autopep8 plugin for Vim |
A Vim plugin for creating better diffs (sometimes)
This plugin allows you to make use of the Patience diff algorithm for generating diffs to use with Vim. This needs the git command line tool available. (But see Update below)
You can also customize your setup to use any other tool to generated diffs (e.g. mercurial) Read the help on how to configure the plugin accordingly.
Here are some screenshots that visualize how the patience/histogram algorithm work.
This is the default diff generated by Vim:
Now change that to using the "histogram" algorithm by running :EnhancedDiff histogram
If Vim is in diff mode, the diff will be updated to this:
Note, that the Patience algorithm might not always provide better diffs. But using this plugin you can at least easily switch between different diffs.
Starting with Vim 8.1.0360 Vim now comes bundled with the xdiff
library and is able to handle diff internally without falling back to
calling diff
as external tool.
This means, one can now simply set diffopt:
if has("patch-8.1.0360")
set diffopt+=internal,algorithm:patience
endif
and Vim will use the patience diff algorithm when creating a diff.
In addition, Vim can now parse context diffs (currently with only zero context lines) from a diff tool when using diff as external tool. So a translation to an ed-like diff is not needed anymore.
So in essence, starting with that Vim version, you don't need to use this plugin anymore.
Using the command :EnhancedDiffIgnorePat pat
you can define patterns, that
will be ignored before feeding the buffer contents to the diff program.
Internally this will be handled by substituting those matches with 'XX'
so that the content will look like the same for the diff binary.
This is how it looks like with a pattern of ^[^;]\+;
and ;[^;]\+$
Use the plugin manager of your choice:
git clone https://github.com/chrisbra/vim-diff-enhanced.git ~/.vim/bundle/vim-enhanced-diff
:Helptags
(only needed once after the installation to install the documentation)NeoBundle 'chrisbra/vim-diff-enhanced'
Plugin 'chrisbra/vim-diff-enhanced'
Plug 'chrisbra/vim-diff-enhanced'
Alternatively download the stable version of the plugin, edit it with Vim (vim EnhancedDiff-XXX.vmb
) and simply source it (:so %
). Restart and take a look at the help (:h EnhancedDiff.txt
)
Once installed, take a look at the help at :h EnhancedDiff
Here is a short overview of the functionality provided by the plugin:
:PatienceDiff
- Use the Patience Diff algorithm for the next diff mode
:EnhancedDiff <algorithm>
- Use <algorithm> to generate the diff.
Use any of
Note: Those 2 commands use the git command line tool internally to generate the diffs. Make sure you have at least git version 1.8.2 installed.
:EnhancedDiffDisable
- Disable plugin (and use default Vim diff capabilities).
In that case, add this snippet to your .vimrc:
" started In Diff-Mode set diffexpr (plugin not loaded yet)
if &diff
let &diffexpr='EnhancedDiff#Diff("git diff", "--diff-algorithm=patience")'
endif
© 2015 by Christian Brabandt. The Vim License applies. See :h license
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK