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"}}}
function! MyFoldText() "{{{
let l:columnend = 80 " column to right align foldtext with
let l:linecount = v:foldend - v:foldstart - 1
" don't display foldmarker braces
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 . '|'
while len(l:postfix) < 11
let l:postfix = ' +' . l:linecount . ' ' . substitute(v:folddashes, "-", "•", "g")
while strchars(l:postfix) < 11
let l:postfix = ' ' . l:postfix
endwhile
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
let l:padding = ' ' . ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'[l:len_line + l:len_postfix + 4:79]
if l:padding[:-1] !== '-'
let l:padding = ' ' . l:padding [0:-1]
endif
let l:padding = substitute(l:padding, "-", "•", "g")
if l:len_line + l:len_postfix <= l:columnend
let l:padding = ' '[l:len_line + l:len_postfix + 0:l:columnend - 1]
let l:foldtext = l:line . l:padding . l:postfix
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
return l:foldtext