svndiff : Shows colored signs in buffer indicating diff with original svn/git file,
| script karma
Downloaded by 3259
Comments, bugs, improvements
script versions (upload new version)
|Screenshot available at http://zevv.nl/play/code/vimscripts/
NOTE: This plugin is unix-only!
An small vim 7.0 plugin for showing RCS diff information in a file while
editing. This plugin runs a diff between the current buffer and the original
file from the version control system, and shows coloured signs indicating
where the buffer differs from the original file from the repository. The
original text is not shown, only signs are used to indicate where changes were
made. With proper key bindings configured, fast navigation between changed
blocks is also provided.
Despite the name 'svndiff' this plugin supports the following RCS systems:
- Perforce / p4
The type of RCS will be detected when first issuing a svndiff command on
The following symbols and syntax highlight groups are used for the signs:
> DiffAdd: Newly added lines. (default=blue)
! DiffChange: Lines which are changed from the original. (default=cyan)
< DiffDel: Applied to the lines directly above and below a deleted block
The plugin defines one function: Svndiff(). This function figures out the
difference between the current buffer and it's RCS original, and adds the
signs at the places where the buffer differs from the original file from svn
or git. You'll need to call this function after making changes to update the
The function takes one argument specifying an additional action to perform:
"prev" : jump to the previous different block
"next" : jump to the next different block
"clear" : clean up all signs
You might want to map some keys to run the Svndiff function. For
example, add to your .vimrc:
noremap <F3> :call Svndiff("prev")<CR>
noremap <F4> :call Svndiff("next")<CR>
noremap <F5> :call Svndiff("clear")<CR>
The following configuration variables are availabe:
If this variable is defined, svndiff will automatically update the signs
when the user stops typing for a short while, and when leaving insert
mode. This might slow things down on large files, so use with caution.
The vim variable 'updatetime' can be used to set the auto-update interval,
but note that changing this variable other effects as well. (refer to the
vim docs for more info)
To use, add to your .vimrc:
let g:svndiff_autoupdate = 1
Normally, two 'delete' signs are placed around the location where
text was deleted. When this variable is defined, only one sign is
placed, above the location of the deleted text.
To use, add to your .vimrc:
let g:svndiff_one_sign_delete = 1
Personally, I find the following colours more intuitive for diff colours:
red=deleted, green=added, yellow=changed. If you want to use these colours,
try adding the following lines to your .vimrc
hi DiffAdd ctermfg=0 ctermbg=2 guibg='green'
hi DiffDelete ctermfg=0 ctermbg=1 guibg='red'
hi DiffChange ctermfg=0 ctermbg=3 guibg='yellow'
1.0 2007-04-02 Initial version
1.1 2007-04-02 Added goto prev/next diffblock commands
1.2 2007-06-14 Updated diff arguments from -u0 (obsolete) to -U0
2.0 2007-08-16 Changed from syntax highlighting to using signs, thanks
to Noah Spurrier for the idea. NOTE: the name of the
function changed from Svndiff_show() to Svndiff(), so
you might need to update your .vimrc mappings!
3.0 2008-02-02 Redesign with some ideas from Jan Bezdekovsky. The
diff is only updated when the buffer actually changes,
cleanup of signs is now done properly and some info
about each diff block is printed in the status line.
3.1 2008-02-04 Fixed bug that broke plugin in non-english locales, thanks
to Bernhard Walle for the patch
3.2 2008-02-27 The latest rewrite broke vim 6 compatiblity. The plugin
is now simply disabled for older vim versions to avoid
a lot of warnings when loading.
4.0 2008-11-24 Added GIT support. The RCS type is now detected (svn/git)
4.1 2008-11-25 Added CVS support.
4.2 2009-07-31 Added support for proper handling of non-unix file formats
which use different newline conventions (dos, mac)
4.3 2010-05-08 Added support for Mercurial, fixed git support (thanks
4.4 2011-03-30 Added support for perforce/p4 (thanks, Timandahaf)
4.5 2011-10-09 Bugfix when trying to use svndiff in a new fileless buffer (Frankovskyi Bogdan)
4.6 2012-06-02 Added support for the Fossil SCM (Andrea Federico Grisotto)
|Copy the file into your ~/.vim/plugin directory, and optionally create a keymap as described above.|
Click on the package to download.
ip used for rating: 126.96.36.199
||Fixed git diffs when cwd is not the top git directory.
||Added support for Fossil
||Added support for the Fossil SCM
||Bugfix when trying to use svndiff on a new buffer without file
||Added support for perforce/p4.
Supported RCS software is now subversion, git, mercurial, cvs and perforce!
||Added support for Mercurial, fixed Git support
||Added CVS support. svndiff now works with subversion, GIT and CVS.
||Added support for GIT, repository type is detected at runtime (subversion / git)
||The latest rewrite broke vim 6 compatiblity. The plugin is now simply disabled for older vim versions to avoid a lot of warnings when loading.
||Fixed script behaviour for non-english locales.
||Major redesign of the plugin:
* auto-update feature highlights svn diff signs while editing
* signs from other sources (debugger, etc) are no longer effected
* better performance, diff is only executed when code is actually modified
||svndiff now uses tags to indicated the difference between the buffer and the original file, so it leaves intact the original syntax highlighting.
||updated to work with recent version of diff (-u0 option was obsolete, changed to -U0)