Vim provides nice syntax folding for Ruby and C (well, that is what I've tried) out of the box, but what about PHP? It doesnt have this feature! Am I missing something?
Folding should work in just about any language that uses parens or brackets, so it should work in PHP. I've added the following few lines as key shortcuts in my .vimrc so that I can automatically fold and unfold all my function definitions in a file quickly by typing comma f or F:
" Folding and unfolding
map ,f :set foldmethod=indent<cr>zM<cr>
map ,F :set foldmethod=manual<cr>zR<cr>
From there you can unfold, or refold levels using z and whatever fold command you like. Good tutorial here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With