Last active
April 21, 2019 06:03
-
-
Save kshenoy/5661847 to your computer and use it in GitHub Desktop.
Function to set the foldtext
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
function! FoldText() | |
" Description: Folding configuration | |
let nucolwidth = &fdc + &number*&numberwidth | |
let winwidth = winwidth(0) - nucolwidth - 3 | |
let foldlinecount = foldclosedend(v:foldstart) - foldclosed(v:foldstart) + 1 | |
let dashtext = strpart(string(v:folddashes),1,len(string(v:folddashes))-2) | |
let foldinfo = "+" . dashtext . " Fold: " . string(v:foldlevel) . ", " . string(foldlinecount) . " lines " | |
let firstline = strpart(getline(v:foldstart), 0 , winwidth - len(foldinfo)) | |
let fillcharcount = winwidth - len(firstline) - len(foldinfo) | |
return firstline . repeat(" ",fillcharcount) . foldinfo | |
endfunction | |
set foldtext=FoldText() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment