My vim configuration
git clone https://github.com/m-col/vim-misc
Files | Refs | Readme

-rw-r--r-- start/self/plugin/folds.vim


      1 "------------------------------------------------------------------"
      2 " Global folding rules
      3 "------------------------------------------------------------------"
      4 
      5 
      6 " format folded section header text
      7 function! GenericFoldText()
      8     let line = getline(v:foldstart)
      9 
     10     let nucolwidth = &fdc + &number * &numberwidth
     11     let windowwidth = winwidth(0) - nucolwidth - 3
     12     let foldedlinecount = v:foldend - v:foldstart
     13 
     14     let onetab = strpart('          ', 0, &tabstop)
     15     let line = substitute(line, '\t', onetab, 'g')
     16 
     17     let line = strpart(line, 0, windowwidth - len(foldedlinecount))
     18     let fillcharcount = windowwidth - len(line) - len(foldedlinecount)
     19     return line . repeat(" ",fillcharcount) . ' ' . foldedlinecount
     20 endfunction
     21 set foldtext=GenericFoldText()
     22 
     23 
     24 "function! GenericFolds()
     25 "    if match(getline(v:lnum), '^\s*' . &commentstring[0] . &commentstring[0]) >=0
     26 "	return ">1"
     27 "    else
     28 "	return "="
     29 "    endif
     30 "endfunction
     31 "
     32 "
     33 "set foldmethod=expr
     34 "set foldexpr=GenericFolds()
     35