count folds ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

count folds ?

M Kelly
Hi,

Is there a way in vim script to count the number of folds present ?

thanks always for the vim universe,
-mark

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: count folds ?

h_east
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.