various fies, change network
[distro-setup] / .vim / ftplugin / java.vim
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 =~ '\%(\%(/\*\*\).*\%(\*/\)\)\|\%({.*}\)' )
7 return '='
8 elseif ( thisLine =~ '\%(^\s*/\*\*\s*$\)\|{' )
9 return "a1"
10 elseif ( thisLine =~ '\%(^\s*\*/\s*$\)\|}' )
11 return "s1"
12 endif
13 return '='
14 endfunction
15 setlocal foldexpr=MyFoldLevel(v:lnum)
16 setlocal foldmethod=expr