> Is there a built-in folding method for patch files? Not AFAIK
> When I open a patch file, I would like to be able to open and close individual > hunks as well as all hunks of a single file. > > Isn't there something built-in? (I know I could write my own fold-expr.) A simple first-pass fold-expr to handle just hunks: :set fdm=expr fde=(getline(v:lnum)=~'^@@')?'>1':'=' For a more complex version, you could use fde=(getline(v:lnum)=~'^Index')?0:(getline(v:lnum)=~'^=\\{3,}')?1:((getline(v:lnum)=~'^@@')?'>2':'=') (all in one line, in case mailers mung it) which should handle both multiple hunks and multiple files-to-be-patched in the same .diff/.patch file. That breaks down as - If it begins with 'Index', don't indent it - If it begins with 3+ "=" signs, start indenting 1 level - If it starts with "@@", consider it the beginning of a hunk and start indent-level-2 - Finally, for everything else, treat it as the indentation that comes from the previous line. It works at least for some of the SVN diff's I've got floating around here. Hope this helps, -tim --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---