Thursday, June 2, 2011

Re: Folding

On 2011-06-02, Eric Weir wrote:

> I just wish I could get rid of the prefix that indicates how many
> lines there are in the fold. No doubt that is useful to some. To
> me it is clutter. It just gets in the way. The text of the top
> level line is sufficient to identify what's in the fold as far as
> I'm concerned.

I don't like all that clutter in the fold line, either, but I do
like to see the number of lines in the fold, so I modified the
appearance of the fold line with this in my ~/.vimrc.

set foldtext=MyFoldText()

" MyFoldText()
"
" This is intended to be the same as the default foldtext()
" function, but without the text of the first line of the fold.
" See f_foldtext() in eval.c to see how the string is built.
"
function! MyFoldText()
let n = v:foldend - v:foldstart + 1
let i = indent(v:foldstart)
let istr = ''
while i > 0
let istr = istr . ' '
let i = i - 1
endwhile
return istr . "+-" . v:folddashes . " " . n . " lines "
endfunction

You could do something similar to get the appearance you want. I
wrote it before the repeat() function was available, so it could
probably be rewritten with five fewer lines today. See

:help fold-foldtext

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment