加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 如何让vim包含三重斜杠的评论?

发布时间:2020-12-16 06:02:39 所属栏目:百科 来源:网络整理
导读:我经常使用gq将较长的注释包含在一些数量的字符中,如果我使用//或/ * / *来评论我的代码,这可以正常工作: // here is a simple comment that exceeds my line width // across multiple lines// here is a simple comment that// exceeds my line width acr
我经常使用gq将较长的注释包含在一些数量的字符中,如果我使用//或/ * / *来评论我的代码,这可以正常工作:
// here is a simple comment that exceeds my line width 
// across multiple lines

// here is a simple comment that
// exceeds my line width across
// multiple lines

但是,如果我有三条斜线的意见,例如对于doxygen,它不工作:

/// here is a simple comment that exceeds my line width
/// across multiple lines

/// here is a simple comment that
// exceeds my line width / across
// multiple lines

vim似乎将最后一条斜杠作为文本的一部分,并不认为它是注释的一部分.如何解决这个问题?这是包含的结果,当我选择三斜杠评论时,我想看到,并按gq:

/// here is a simple comment that
/// exceeds my line width across
/// multiple lines

请注意,我不想影响正常c注释的现有行为.

我正在使用vim 7.4.52

解决方法

将它添加到您的.vimrc文件应该做的诀窍:
autocmd Filetype c,cpp set comments^=:///

有关注释格式的帮助可以在以下网址找到:h格式评论.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读