mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
update foldtext function
This commit is contained in:
parent
2b015bd51e
commit
191abbcf88
@ -68,11 +68,11 @@ endfunction
|
|||||||
" Custom fold text, adapted from https://vi.stackexchange.com/a/3818/15292
|
" Custom fold text, adapted from https://vi.stackexchange.com/a/3818/15292
|
||||||
" and https://vi.stackexchange.com/a/6608/15292
|
" and https://vi.stackexchange.com/a/6608/15292
|
||||||
function! utils#MyFoldText() abort
|
function! utils#MyFoldText() abort
|
||||||
let line = getline(v:foldstart)
|
let l:line = getline(v:foldstart)
|
||||||
let folded_line_num = v:foldend - v:foldstart
|
let l:fold_line_num = v:foldend - v:foldstart
|
||||||
let line_text = substitute(line, '^"{\+', '', 'g')
|
let l:fold_text = substitute(l:line, '^"{\+', '', 'g')
|
||||||
let fillcharcount = &textwidth - len(line_text) - len(folded_line_num) - 10
|
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), line_text, repeat('.', fillcharcount), folded_line_num)
|
return printf('+%s%s%s (%s L)', repeat('-', 4), l:fold_text, repeat('.', l:fill_char_num), l:fold_line_num)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Toggle cursor column
|
" Toggle cursor column
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user