History Report a problem
Article Edit this page Discussion

Automatically generate PHPdoc comments

From Vim Tips Wiki

(Redirected from VimTip407)
Jump to: navigation, search

Tip 407 Previous TipNext Tip

Created: January 18, 2003 Complexity: intermediate Author: Klaus Horsten Minimum version: 6.0 Karma: 16/4 Imported from: Tip#407


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:

Contents

[edit] 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;
}

[edit] 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 {
 ...
}

[edit] Example 3

For a class-variable you get:

/**
 *
 */
var $urls;

[edit] 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.

[edit] Comments

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pushing Daisies
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Astronomy Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions


Vote for featured Wikia!

Send this article to a friend
"Automatically generate PHPdoc comments"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation