update foldtext()

This commit is contained in:
ManjaroOne666 2018-09-25 16:30:12 +01:00
parent c85c80b1e2
commit a43cdb83b2
1 changed files with 11 additions and 11 deletions

22
vimrc
View File

@ -606,28 +606,28 @@ function! GetStatusFrag(condition, colorname, conditionprefix, text) abort "{{{
endfunction"}}} endfunction"}}}
function! MyFoldText() "{{{ function! MyFoldText() "{{{
let l:columnend = 80 " column to right align foldtext with
let l:linecount = v:foldend - v:foldstart - 1 let l:linecount = v:foldend - v:foldstart - 1
" don't display foldmarker braces
let l:line = substitute(getline(v:foldstart), "\{\{\{", "", "") let l:line = substitute(getline(v:foldstart), "\{\{\{", "", "")
let l:line = substitute(l:line, "\^\" ", "", "") " don't display vim comment quotation marks
let l:line = substitute(l:line, "\^\"\\s\\?", "", "")
let l:postfix = ' +' . l:linecount . ' ' . v:folddashes . '|' let l:postfix = ' +' . l:linecount . ' ' . substitute(v:folddashes, "-", "•", "g")
while len(l:postfix) < 11 while strchars(l:postfix) < 11
let l:postfix = ' ' . l:postfix let l:postfix = ' ' . l:postfix
endwhile endwhile
let l:len_line = len(l:line) let l:len_line = len(l:line)
let l:len_postfix = len(l:postfix) let l:len_postfix = strchars(l:postfix)
if l:len_line + l:len_postfix <= 80 if l:len_line + l:len_postfix <= l:columnend
let l:padding = ' ' . ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'[l:len_line + l:len_postfix + 4:79] let l:padding = ' '[l:len_line + l:len_postfix + 0:l:columnend - 1]
if l:padding[:-1] !== '-'
let l:padding = ' ' . l:padding [0:-1]
endif
let l:padding = substitute(l:padding, "-", "•", "g")
let l:foldtext = l:line . l:padding . l:postfix let l:foldtext = l:line . l:padding . l:postfix
else else
let l:foldtext = l:line[:76 - l:len_postfix] . '...' . l:postfix let l:sniptext = '⋯'
let l:foldtext = l:line[:l:columnend - 1 - strchars(l:sniptext) - l:len_postfix] . l:sniptext . l:postfix
endif endif
return l:foldtext return l:foldtext