在 vim 中为各种文件类型启用语法高亮 [英] Enable syntax highlighting for various filetypes in vim
本文介绍了在 vim 中为各种文件类型启用语法高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以通过执行以下操作为具有 vim 未知扩展名的文件启用语法突出显示
I can enable syntax highlighting for a file that has an extension that is unknown to vim by doing the following
设置语法=c
然而,每次我切换标签时,我都必须租用命令.有没有办法让vim知道扩展名为.xyz
的文件应该用C语法着色?
Every time I switch tabs however, I have to renter the command. Is there any way to let vim know that a file with an extension .xyz
should be coloured with C syntax?
推荐答案
使用自动命令.例如
au BufNewFile,BufRead *.xyz setf c
这篇关于在 vim 中为各种文件类型启用语法高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文