tags:

views:

255

answers:

2

Vim privedes 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?

+1  A: 

there is a plugin that should solve your problem

http://www.vim.org/scripts/script.php?script%5Fid=1623

Eineki
It doesn't fold newly written lines for me so I have to reenable it mannualy every time I have finished writing portion of code.
John Doe
+2  A: 

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.

mmrobins