Skip to content


Switch branches/tags
This branch is 11 commits ahead of vim-scripts:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
This is a mirror of

PHP Documentor for Vim (pdv)
Version: 1.1.1
Last Change: 2011-11-19
Author: Tobias Schlitt <>
License: Provided under the GPL (

Copyright 2005-2011 by Tobias Schlitt <>
Inspired by phpDoc script for Vim by Vidyut Luther (

This script provides functions to generate docblocks for your PHP code that
conform to the phpDocumentor format. The script currently documents:

- Classes
- Methods/Functions
- Attributes/Properties

All of those supporting all PHP 4 and 5 syntax elements.

Beside that it allows you to define default values for phpDocumentor tags
like @version (I use $Id$ here), @author, @license and so on.

For function/method parameters and attributes, the script tries to guess the
type as good as possible from PHP5 type hints or default values (array, bool,
int, string...).

You can use this script by mapping the function PhpDoc() to any
key combination. Hit this on the line where the element to document
resides and the doc block will be created directly above that line.


For example include into your .vimrc:

au BufRead,BufNewFile *.php inoremap <buffer> <C-P> :call PhpDoc()<CR>
au BufRead,BufNewFile *.php nnoremap <buffer> <C-P> :call PhpDoc()<CR>
au BufRead,BufNewFile *.php vnoremap <buffer> <C-P> :call PhpDocRange()<CR>

This will map <ctrl>+p to call the functions to create the docblocks for the
item on the line where the cursor is, or in visual mode, any applicable lines
within that range.

In your .vimrc you can also set the defaults for one or more of the PHP
docblock tags:
let g:pdv_cfg_Package = 'YourPackage'
let g:pdv_cfg_Author = 'Your Name <>'

In you .vimrc, you can also specify the tags and the order they appear for
class docblocks:
let g:pdv_cfg_ClassTags = ["package","author","version"]


Version 1.0.0
 * Created the initial version of this script while playing around with VIM
 scripting the first time and trying to fix Vidyut's solution, which
 resulted in a complete rewrite.

Version 1.0.1
 * Fixed issues when using tabs instead of spaces.
 * Fixed some parsing bugs when using a different coding style.

Version 1.1.0
 * Fixed bug with call-by-reference parameters.

Version 1.1.1
 * Updated implementation to allow for better defaults, handle custom sort
 order and inclusion of tags for classes
 * Corrected detection of bool var types
 * Corrected detection of float var types
 * Moved to ftplugin and updated usage instructions


Provides really comfortable generation of phpDocumentor doc blocks for PHP4 & 5.






No packages published


  • Vim Script 100.0%