Created
August 28, 2010 11:41
-
-
Save thinca/555043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script has been moved to http://github.com/thinca/vim-ft-diff_fold.