Hyun Ho Yeo
Hyun Ho Yeo

Reputation: 187

Write function comments in vim

/********************************************************* 

 * Function Name:
 * Parameter:
 * Purpose:

 ********************************************************/

I always write function comments manually as above, but it seems like waste of time.

  1. Are there any useful vim plugins to do this kind of things?

  2. How could I map this utility to a short cut key (like '< Leader >cm') in vim?

Thank :)

Upvotes: 0

Views: 435

Answers (2)

Ingo Karkat
Ingo Karkat

Reputation: 172570

snippets are like the built-in :abbreviate on steroids, usually with parameter insertions, mirroring, and multiple stops inside them. One of the first, very famous (and still widely used) Vim plugins is snipMate (inspired by the TextMate editor); unfortunately, it's not maintained any more; though there is a fork. A modern alternative (that requires Python though) is UltiSnips. There are more, see this list on the Vim Tips Wiki.

There are three things to evaluate: First, the features of the snippet engine itself, second, the quality and breadth of snippets provided by the author or others; third, how easy it is to add new snippets.

Upvotes: 2

Luc Hermitte
Luc Hermitte

Reputation: 32936

You could do it by hand with abbreviations or mappings, but I'd recommend you instead to search for a snippet/template plugin that suits you. There exist many.

BTW, there exist plugins that are able to fill javadoc, or doxygen comments based on function signatures. This goes a step further than what you're strictly looking for.

Upvotes: 3

Related Questions