Skip to content

Instantly share code, notes, and snippets.

@thinca
Created August 28, 2010 11:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinca/555043 to your computer and use it in GitHub Desktop.
Save thinca/555043 to your computer and use it in GitHub Desktop.
setlocal foldmethod=expr foldexpr=DiffFold(v:lnum)
function! DiffFold(lnum)
let line = getline(a:lnum)
let next = getline(a:lnum + 1)
if line =~ '^[-=]\{3}'
return 1
elseif next =~ '^[-=]\{3}'
return '<1'
elseif line =~ '^@@'
return 2
elseif next =~ '^@@'
return '<2'
endif
return '='
endfunction
@thinca
Copy link
Author

thinca commented Oct 4, 2010

This script has been moved to http://github.com/thinca/vim-ft-diff_fold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment