Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Automatic folding of PHP functions, classes,.. (also folds related PhpDoc)
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a mirror of

This script can fold PHP functions and/or classes, properties with their PhpDoc, 
without manually adding marker style folds ({{{ and }}}). It will generate the following 
folds when executed:

* This is Foo...
* @author Foo
class Foo {
+-- 11 lines: function fooFunction($bar) ** -----------------------------------------
+--   8 lines: function fooFunction2($bar) ** ----------------------------------------
+-- 24 lines: function fooFunction3($bar) -------------------------------------------

+--112 lines: class Foo2 ** -------------------------------------------------------------

Based on e.g. functions declared like this:

 * This is fooFunction...
 * @param mixed $bar 
 * @access public
 * @return void
function fooFunction($bar) {

You can view a screenshot here:

- It remembers fold settings. If you add functions and execute the script again, 
  your opened folds will not be closed.
- It will not be confused by brackets in comment blocks or string literals.
- The folding of class properties with their PhpDoc comments.
- The folding of all class properties into one fold.
- Folding the original marker style folds too.
- An "**" postfixing the fold indicates PhpDoc is inside (configurable).
- An "**#@+" postfixing the fold indicates PhpDocBlock is inside (configurable).
- Empty lines postfixing the folds can be configured to be included in the fold.
- Nested folds are supported (functions inside functions, etc.)

- Better 'configurability' as opposed to editting the PHPCustomFolds() function and
  some "Script configuration" global variables.

If anyone has emailed me and I have not replied, it's probably lost. I just found out 
hotmail recognizes alot as junk. I now turned off the junk filter..

I'm currently more active again with this project, so if you have any contributions to 
this project, please let me know.

This script is tested successfully with Vim version >= 6.3 on windows and linux
(With 6.0 it works *sometimes*, I don't recommend using it in that version)
Something went wrong with that request. Please try again.