sponsor Vim development Vim logo Vim Book Ad

diff-fold.vim : Folds changesets, files, and hunks in Mercurial diff output

 script karma  Rating 0/4, Downloaded by 1108  Comments, bugs, improvements  Vim wiki

created by
Ryan Mechelke
script type
Pipe various Mercurial diff output to vim and see changesets, files, and
hunks folded nicely together.  In addition to providing folding of diff
text, diff_fold also provides a navigation pane which you can use to more
easily navigate large diffs.

Some examples:
    hg in --patch | vim -
    hg diff | vim -
    hg diff -r 12 -r 13 | vim -
    hg export -r 12: | vim -
    hg log --patch src\somefile.cpp | vim -

Navigation pane usage:
    The keybinding <Leader>nav will bring up the navigation pane.  You can
    use the 'Enter' or 'v' keys to either go to, or view whole changsets
    or files in the Diff View

    If you don't like the default mapping, you can map a new one as
        map {newmap} <Plug>DiffFoldNav

Right now, this pretty much just works with Mercurial diff output.  Because Hg can use Git style patches, it does work with some Git output but it is not 100% reliable or useful.

Eventually, I hope to make this work with more version control systems and just about anything that can produce unified diff output.

This plugin has also been made into a pathogen bundle and can be installed with an 'hg clone https://bitbucket.org/thetoast/diff-fold' in your pathogen bundle folder.
In the future, the pathogen bundle may be more up-to-date, but any major updates will be made available here.
install details
Unzip into your ~/.vim or vimfiles folder.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
diff-fold.zip 0.4 2011-02-10 7.0 Ryan Mechelke * Added syntax highlighting to changeset details
* Added a navigation pane for navigating large diffs
diff-fold.zip 0.3.1 2011-01-11 7.0 Ryan Mechelke * Fixed a bug with 'hg export' style changsets
* Added foldtext for 'hg export' style changesets
* Made global commands silent
diff-fold.zip 0.3 2011-01-07 7.0 Ryan Mechelke * Adding an ftdetect script so that hg output is recognized automatically. '-c "setlocal ft=diff"' no longer required
* Adding support for folding changesets produced by 'hg export' command
* More error handling
diff_fold.vim 0.2 2010-10-01 7.0 Ryan Mechelke * changed all "exec normal" calls to "normal!"
* checking for existence of final hunks/diffs/changesets to avoid double-folding in some cases
* foldtext now being set with "setlocal"

Thanks, Ingo, for the patch!
diff.vim 0.1 2010-10-01 7.0 Ryan Mechelke Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
OSDN.net Logo