Vim Tips Wiki
(Change to TipImported template + severe manual clean)
(Move categories to tip template)
Line 9: Line 9:
 
|version=6.0
 
|version=6.0
 
|rating=16/4
 
|rating=16/4
 
|category1=Automated_Text_Insertion
  +
|category2=PHP
 
}}
 
}}
 
Use JCommenter.vim for php-scripts:
 
Use JCommenter.vim for php-scripts:
Line 85: Line 87:
   
 
==Comments==
 
==Comments==
[[Category:Automated_Text_Insertion]]
 
[[Category:PHP]]
 

Revision as of 01:24, 25 April 2008

Tip 407 Printable Monobook Previous Next

created January 18, 2003 · complexity intermediate · author Klaus Horsten · version 6.0


Use JCommenter.vim for php-scripts:

jcommenter.vim : A script for automatically generating JavaDoc comments

PHPdoc is an imitation of JAVAdoc. The syntax between the two languages is very close, see the examples below:

Example 1

A PHP function.

function serialize_it($something) {
  $person = serialize($something);
  return $person;
}

Put the cursor on the first line and type :call JCommentWriter()<CR>

You get:

/**
 *
 *
 * @param $something
 * @return
 */
function serialize_it($something) {
  $personen = serialize($something);
  return $personen;
}

Example 2

A PHP class.

class submenu {
 ...
}

Put the cursor on the first line and type :call JCommentWriter()<CR>

You get:

/**
 *
 *
 * @author
 * @version
 */
class submenu {
 ...
}

Example 3

For a class-variable you get:

/**
 *
 */
var $urls;

Note

It does not work if you have = like in

function serialize_it($something = ) {}

But I think jscript.vim can be adapted for the use with PHP.

Comments