- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
如前所述in this answer ,从 Git 1.8.2 开始,您可以使用 core.commentchar
配置值将提交消息注释更改为默认 #
(井号或井号)以外的其他内容。
那是救命稻草如果您的提交消息策略希望您使用票号开始提交消息:
#123 Fixed array indices
可悲的是,这会破坏 Vim 语法高亮。
怎样才能把美丽带回来?
最佳答案
您应该尝试运行 :verbose syntax
。事件语法文件可能是 $VIMRUNTIME\syntax\gitcommit.vim
(github version 可能在您的 .vim
中)。
它会告诉您哪个语法行将触发格式化为注释。
您可能会看到类似这样的内容:
gitcommitComment xxx match /^#.*/
links to Comment
或
syn match gitcommitComment "^#.*"
意味着它匹配以 #
开头的每一行。
您可以修改它,以便第一行的 #
不被视为注释。我对 syntax
格式的了解不足以为您提供完整的解决方案。
\%^ match the beginning of file
\%1l match line 1
\%>1l match below line 1
因此您可能会尝试修改 gitComment 模式,使其在您的 git 提交的第 1 行不起作用。
(我尝试了一些方法,但没有设法只排除第一行评论!似乎还有一个 diffComment
把事情搞砸了,因为 gitcommit 包含 diff 格式和 syn include @gitcommitDiff语法/diff.vim
))
有关详细信息,请参阅:help syntax
和:help pattern
。
关于语法高亮的另一个很好的资源:Learn Vim the Hard Way, chapter 46 .
关于git - git 提交消息的 vim 语法突出显示 - 自定义 commentchar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16164624/
有没有一种方法可以“标记”对象的属性,使它们在反射中“突出”? 例如: class A { int aa, b; string s1, s2; public int AA
我是一名优秀的程序员,十分优秀!