diff --git a/autoload/utils.vim b/autoload/utils.vim index de1446e..07113af 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -68,11 +68,11 @@ endfunction " Custom fold text, adapted from https://vi.stackexchange.com/a/3818/15292 " and https://vi.stackexchange.com/a/6608/15292 function! utils#MyFoldText() abort - let line = getline(v:foldstart) - let folded_line_num = v:foldend - v:foldstart - let line_text = substitute(line, '^"{\+', '', 'g') - let fillcharcount = &textwidth - len(line_text) - len(folded_line_num) - 10 - return printf('+%s%s%s (%s L)', repeat('-', 4), line_text, repeat('.', fillcharcount), folded_line_num) + let l:line = getline(v:foldstart) + let l:fold_line_num = v:foldend - v:foldstart + let l:fold_text = substitute(l:line, '^"{\+', '', 'g') + let l:fill_char_num = &textwidth - len(l:fold_text) - len(l:fold_line_num) - 10 + return printf('+%s%s%s (%s L)', repeat('-', 4), l:fold_text, repeat('.', l:fill_char_num), l:fold_line_num) endfunction " Toggle cursor column