On Tuesday, November 20, 2012 4:31:27 PM UTC-6, Philip Rhoades wrote:
> 
> > fun! MyFoldBlocks()
> 
> >   if getline(v:lnum)=~'\v^(if|(\S&.*\{)|SomeOtherBlockBeginning)'
> 
> >     return ">1"
> 
> >   elseif getline(v:lnum)=~'\v^(end|\}|SomeOtherBlockEnding)'
> 
> >     return "<1"
> 
> >   else
> 
> >     return "="
> 
> >   endif
> 
> > endfun
> 
> > setl foldexpr=MyFoldBlocks() fdm=expr
> 
> 
> 
> 
> This nearly does what I want but I want the first (and maybe the last 
> 
> line?) of the block visible eg:
> 
> 
> 
> if ..)
> 
> folded
> 
> end
> 
> 
> 
> since the actual blocks can get quite large and I just want to see the 
> 
> overall logic.  I guess that means doing something with lnum?
> 
> 
> 

Sure, you can get the previous line with getline(v:lnum-1) or the next line 
with getline(v:lnum+1).

Or you could mess with the 'foldtext' option to adjust what gets displayed when 
you fold stuff away.

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

Reply via email to