From a43cdb83b2861f8190015d1b2c1476ffba82cdbd Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Tue, 25 Sep 2018 16:30:12 +0100 Subject: [PATCH] update foldtext() --- vimrc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/vimrc b/vimrc index ea93d92..423251d 100644 --- a/vimrc +++ b/vimrc @@ -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