What "did not work" with indent
?
Both syntax
and indent
work, but your problem may be that both methods don't take comments into account so they don't do anything for your sample (they see only one line so there's nothing to fold).
As soon as you have more than one line of actual code, za
, zM
, zR
and friends work perfectly.
Another method worth trying is marker
, using :set foldmarker={,}
allows you to turn:
myFnName <- function(some, args){
#some description or not
some code
}
into:
+-- 4 lines : myFnName <- function(some, args)--------
with a simple za
.
Anyway, I recommend these two vimcasts if you want more control: