Sunday, September 30, 2018

Re: count folds ?

Hi,

2018-10-1(Mon) 5:10:36 UTC+9 M Kelly:
> Hi,
>
> Is there a way in vim script to count the number of folds present ?
>
> thanks always for the vim universe,
> -mark

See the following documents.

:h foldclosed()
:h foldclosedend)

---- sample start ----
func! GetFoldLines(lnum)
let fstart = foldclosed(a:lnum)
if fstart == -1
return -1
else
return foldclosedend(a:lnum) - fstart + 1
endif
endfunc

echo GetFoldLines(".")
---- sample end ----

--
Best regards,
Hirohito Higashi (h_east)

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment