Alo*_*dal 15 git vim comments syntax-highlighting
如本回答所述,自Git 1.8.2起,您可以使用core.commentchar配置值将提交消息注释更改为默认值#(hashmark或hashsign)之外的其他内容.
这样可以节省生命,例如,如果您的提交消息策略要求您启动带有票号的提交消息:
#123 Fixed array indices
Run Code Online (Sandbox Code Playgroud)
可悲的是,这打破了Vim语法高亮.
你怎么能把美丽带回来?
Xav*_* T. 14
你应该试着跑:verbose syntax.活动语法文件可能是$VIMRUNTIME\syntax\gitcommit.vim(github版本,可能在您的版本.vim).
它会告诉您哪个语法行将触发格式化为注释.
你可能会看到类似的东西:
gitcommitComment xxx match /^#.*/
links to Comment
Run Code Online (Sandbox Code Playgroud)
要么
syn match gitcommitComment "^#.*"
Run Code Online (Sandbox Code Playgroud)
意味着它匹配每一行开头#.
您可以修改它,以便#第一行上的a 不被视为注释.我不知道syntax格式足以给你一个完整的解决方案.
\%^ match the beginning of file
\%1l match line 1
\%>1l match below line 1
Run Code Online (Sandbox Code Playgroud)
因此,您可能会尝试修改gitComment模式,以便它不能在您的git提交的第1行上运行.
(我尝试了一些东西,但没有设法只排除第一行评论!似乎还有一些diffComment搞乱的事情,因为gitcommit包括diff格式syn include @gitcommitDiff syntax/diff.vim))
有关详细信息,请参阅:help syntax和:help pattern.
关于语法highligthing的另一个好资源:第46章学习Vim艰难之路.
| 归档时间: |
|
| 查看次数: |
3696 次 |
| 最近记录: |