Thursday, June 2, 2011

Re: Folding

On Jun 2, 8:47 am, Eric Weir <eew...@bellsouth.net> wrote:
>
> I meant both. I see that neither accomplishes what I wanted, i.e., for the folded indent to display as indented. As it is, it appears to me that the only way to know a fold is indented is to undent it.
>
> [Snip]
>
> 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.  
>

Ah, so you want to modify what is displayed in place of the folded
text. This is certainly possible, using the 'foldtext' option.

If you can specify exactly what you want folded text to look like,
someone can help you make one. Or you can try your hand yourself.
There are a couple of examples at :help fold-foldtext and also
http://vim.wikia.com/wiki/Folding_for_plain_text_files_based_on_indentation
and http://vim.wikia.com/wiki/Customize_text_for_closed_folds. The
first link above may be very close to what you are looking for by
itself.

The caveat to remember in terms of indenting folded lines is that a
tab character in the fold text is replaced with a single space, so
you'll need to do something like this to replace it:

linetext = substitute(getline(v:foldstart),'^\s\+','\=repeat("
",strdisplaywidth(submatch(0)))', '')

This replaces a sequence of whitespace at the beginning of the line ('^
\s\+') with a sequence of space characters ( repeat(" " ) of length
equal to the width of the whitespace sequence as displayed in Vim
( strdisplaywidth(submatch(0)) ).

--
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