void-pointer
void-pointer

Reputation: 14827

Vim: Getting gq Not to Displace `**' in Comment Block

Suppose I have a nice comment block, such as the one below

/*
** This is a nice comment block. Displace the `**'s and I will eat your nose! Also, here is a long line of text clearly longer than the textwidth, which should force gq to rearrange the lines. Wheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...
**
**
*/

and that I apply gq to format it and ensure that no line exceeds the character count. How can I get gq not to displace the initial `**'s that prepend each comment line?

Thank you very much!

Upvotes: 1

Views: 250

Answers (1)

Useless
Useless

Reputation: 67713

See :help format-comments. I get the result you want from

:set comments=s0:/*,mb:**,ex:*/

Upvotes: 3

Related Questions