How to collapse or expand source code in vim on HTML, PHP, etc?

EDIT: I know the basic folding command but what I need is something much more advance and intelligent such as in Visual Studio. I think it could not help without some really good plugin.

  • 4
    For reference, the basic folding commands in vim are zf{motion} to create a fold, zo to open a fold, and zc to close a fold. – Kristo Nov 21 '11 at 20:10

:help foldcolumn will tell you about how to create a small area left of the text that contains some controls to fold and unfold.

read about :help foldmethod about how to create folds automatically, eg. :set foldmethod=syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.