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
"Result: | |
"........................................ Text Here ( x lines ) ......................................... | |
function! SuperSexyFoldText() "{{{ | |
let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' ' | |
let lines_count = v:foldend - v:foldstart + 1 | |
let lines_count_text = printf("%s", lines_count) | |
let foldchar = " " | |
let foldtextstart = strpart('' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) | |
let foldtextend = ' ( ' . repeat(" ", 5 - len(lines_count_text)) . lines_count_text . repeat(" ", 2) . "lines" . ' ) ' | |
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn |
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
" Warning this will alter the highlighting of the columns | |
" beforehand sometimes as well. | |
set textwidth=80 " text width | |
exe 'set synmaxcol=' . &tw | " If it goes past tw, don't highlight it |