On Mo, 20 Feb 2012, Christian Brabandt wrote:
> Hi Antonio!
>
> On Mo, 20 Feb 2012, Antonio Recio wrote:
>
> > That's works great!
> >
> > I would like to include too the folding of \subtitle->\clearpage.
> >
> > How I can fold these lines:
> > htitle
> > ----
> > \clearpage
> >
> > htitle
> > subtitle
> > ----
> > \clearpage
> >
> > subtitle
> > ----
> > \clearpage
> >
> > To this?:
> > + htitle
> > + htitle
> > + subtitle
>
> Try this:
>
> fu! FoldTeXLines(lnum)
> if !exists("s:fold")
> let s:fold = '0'
> endif
> let line = getline(a:lnum)
> if line =~ '^\s*\\htitle'
> let s:fold = '>1'
> return s:fold
> elseif line =~ '^\s*\\subtitle' && s:fold != '>1'
> let s:fold = '>1'
> return s:fold
> elseif line =~ '^\s*\\clearpage'
> let s:fold = '<1'
> return 1
> endif
> return '='
> endfu
That looks a little bit odd. Better is this:
fu! FoldTeXLines(lnum)
if !exists("s:fold")
let s:fold = '0'
endif
let line = getline(a:lnum)
if line =~ '^\s*\\htitle'
let s:fold = '>1'
elseif line =~ '^\s*\\subtitle' && s:fold != '>1'
let s:fold = '>1'
elseif line =~ '^\s*\\clearpage'
let s:fold = '<1'
else
let s:fold = '='
endif
return s:fold
endfu
regards,
Christian
--
Ein Stotterer und ein Mann mit Glatze unterhalten sich.
Stotterer: "Wwwiiie tteuer wa wa war dddenn Ddeinnne Fri Frisur?"
Glatzkopf: "Oh, nur 26 Mark, genau so teuer wie bei Dir ein Ortsgespräch!"
--
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