diff options
| author | jdhao <jdhao@hotmail.com> | 2020-09-30 16:23:38 +0800 |
|---|---|---|
| committer | jdhao <jdhao@hotmail.com> | 2020-09-30 16:23:38 +0800 |
| commit | 191abbcf88d607384f88ce2fba44f83b97fc0bbe (patch) | |
| tree | 2b881090ccb425b61b554f85ea92ef2e8373f7c8 /autoload/utils.vim | |
| parent | 2b015bd51e52a0ca6e56fcbdd92238e44ee5401a (diff) | |
update foldtext function
Diffstat (limited to 'autoload/utils.vim')
| -rw-r--r-- | autoload/utils.vim | 10 |
1 files changed, 5 insertions, 5 deletions
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 |
