Vim:让 gq 不要在注释块中替换"**"

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

本文关键字:替换 注释 gq Vim      更新时间:2023-10-16

假设我有一个不错的注释块,比如下面的那个

/*
** 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...
**
**
*/

并且我应用CCD_ 1来格式化它,并确保没有一行超过字符计数。如何使gq不替换每个注释行前的首字母"**"?

非常感谢!

参见:help format-comments。我从得到你想要的结果

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