Friday, June 3, 2011

Re: Folding

On Jun 2, 2011, at 10:36 AM, Gary Johnson wrote:

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

Thanks, Gary. As I mentioned in my original post on this thread, I'm not a programmer. I think I understand what this does, but from your description, not the code. As I understand it eliminates all text except the number of lines. I want to eliminate the number of lines and keep the text from the first line of the fold. And I have absolutely no idea how to go about revising the code to make it do what I want.

Thanks again nevertheless.

Sincerely,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eeweir@bellsouth.net


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