On Sat, Jan 09, 2010 at 12:28:06PM EST, Chris Jones wrote:
> On Sat, Jan 09, 2010 at 07:49:54AM EST, Christian Brabandt wrote:

[..]

> > ,----[ ~$ cat ~/.vim/after/ftplugin/help.vim ]-
> > | setl fdm=expr
> > | setl 
> > foldexpr=getline(v\:lnum-1)=~'-\\{70}'?'>2'\:getline(v\:lnum-1)=~'=\\{70}'?'>1'\:getline(v\:lnum)=~'=\\{70}'?'0'\:getline(v\:lnum)=~'-\\{70}'?'1'\:'='
> > | setl 
> > foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',\"\",\"\"),'^--','\
> >  \ \ \ \ \ ','')
> > `----
> > 
> > (You might also want to set foldlevel.)
> > 
> > However, personally, I did not find this very readable. I think, it 
> > would be better to set these settings via a function, so that it is more 
> > readable (and you don't need to escape every second character or so).
> 
> Let me give it a try and see if there's a chance I may want to amend it
> at some point in the future.

Works surprisingly well out of the box.

There seems to be a problem in some cases with foldtext returning a line
of dashes¹, the pattern seems to be the presence of a leading blank on
the first line of the section - ' 1. section' vs. '1. section'. 

So it looks like I will have to take a closer look at foldtext, and if I
can figure it out, 'amend' it. :-(

But thanks for your advice, it appears to work about nine time out of
ten, which I find really useful - and much cheaper than Amazon's Kindle
for the long winter nights.  :-)

Thanks,

CJ

¹Actually, removing the foldtext modeline makes the content of the first
line reappear, though not with the best of formatting.
-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to