History Report a problem
Article Edit this page Discussion

Continuing doxygen comments

From Vim Tips Wiki

Jump to: navigation, search

Tip 653 Previous TipNext Tip

Created: February 10, 2004 Complexity: intermediate Author: Michael Brailsford Minimum version: 6.0 Karma: 6/6 Imported from: Tip#653


This will continue lines of /// doxygen comments when you reach the end of a line while typing a comment. It also works if you use o to open a new line while on a comment starting with ///. It only works if there is a space between the last / and the first letter of the comment, that is no big deal, since it lends itself to readability. So for example:

/// This will work.
///This won't.

Here is the magic line. Make sure you put it somewhere that will get sourced whenever you open a file you want to use with doxygen. I have it in ~/.vim/after/ftplugin/c/c.vim, so it gets sourced for all C and C++ files.

set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,bO:///,O://

All other comments will continue to work as expected.

[edit] References

[edit] Comments

I use:

set comments-=://
set comments+=:///,://

True, it puts them at the end of the comment expression list, but I don't think that will be a problem. This way, I don't have to worry about any other comment expressions that may be present.

Keep in mind that loading a new syntax file overwrites whatever you have set "comments" to be. Add this to your vimrc if you don't want to keep retyping "set comments..."

autocmd FileType c,cpp set comments-=://
autocmd FileType c,cpp set comments+=://!
autocmd FileType c,cpp set 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
"Continuing doxygen comments"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation