1 " Javadoc comments (/** and */ pairs) and code sections (marked by {} pairs) mark the start and end of folds. All other
2 " lines simply take the fold level that is going so far.
3 function! MyFoldLevel( lineNumber )
4 let thisLine = getline( a:lineNumber )
5 " If the entire Javadoc comment or the {} pair is on one line, then don't create a fold for it.
6 if ( thisLine =~ '\%(\%(/\*\*\).*\%(\*/\)\)\|\%({.*}\)' )
8 elseif ( thisLine =~ '\%(^\s*/\*\*\s*$\)\|{' )
10 elseif ( thisLine =~ '\%(^\s*\*/\s*$\)\|}' )
15 setlocal foldexpr=MyFoldLevel(v:lnum)
16 setlocal foldmethod=expr