Vim:让 gq 不取代 `**'在评论区

发布于 2025-01-05 16:24:36 字数 425 浏览 2 评论 0原文

假设我有一个很好的注释块,例如下面的注释块

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

,并且我应用 gq 来格式化它并确保没有行超过字符数。如何让 gq 不替换每个注释行前面的初始“**”?

非常感谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

灯角 2025-01-12 16:24:36

请参阅:帮助格式注释。我得到你想要的结果

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

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

:set comments=s0:/*,mb:**,ex:*/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文