if exists("b:did_ftplugin") finish endif let b:did_ftplugin = 1 if findfile("Makefile", ".;/") != '' let &l:makeprg="make -f ".findfile("Makefile", ".;/") endif function! XCodeFold(lnum) let line = getline(a:lnum) if line =~ '^.pragma mark -' return '<1' endif if line =~ '^.pragma mark' return '>1' endif return '=' endfunction function! XCodeFoldText() let text = v:folddashes . " [ " let text .= substitute(getline(v:foldstart), '#pragma mark ', '', 'g') let text .= " ] " . string(v:foldend - v:foldstart + 1) . " lines " return text endfunction setl foldexpr=XCodeFold(v:lnum) setl foldtext=XCodeFoldText() setl foldmethod=expr