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
fu! FoldText(line)
return '+ '. matchstr(getline(a:line),'^\s*\\\(h\|sub\)title{\zs.*\ze}')
endfu
setl fdm=expr fde=FoldTeXLines(v:lnum) fdt=FoldText(v:foldstart)
regards,
Christian
--
Wie man sein Kind nicht nennen sollte:
Asta Lavista
--
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