vim fold: ignore while, if, and for
In vim, I use syntax folding with C++. How do I ignore the folding in my whil开发者_运维百科e
, if
and for
constructs?
According to http://vim.1045645.n5.nabble.com/fold-functions-only-not-if-for-switch-td2834720.html, you could do it with
:set foldmethod=expr
... and then define foldexpr
to an expression which will say what to fold (see :help fold-expr
). This would be very tedious, though, and there must be a better way.
While it is not a perfect answer you could try to fiddle around with foldlevel too see if that might fit your needs.
:help fold-foldlevel
It will not solve your problem perfectly but seeing as C++ normally don't go that deep I am thinking that you could set it to your standard function level and have it all folded up to that level.
Hope it helps :)
精彩评论