mac下vim设置conf高亮

1. 打开conf.vim

sudo vi /usr/share/vim/vim73/syntax/conf.vim

输入电脑密码


2. 加入以下代码

syn region confClass start=+\[+ end=+\]+ oneline
syn region confKey   start=+.+  end=+:+  oneline
syn match confNumber '\d\+' 
syn match confNumber '[-+]\d\+' 
syn match confNumber '\d\+\.\d*' 
syn match confNumber '[-+]\d\+\.\d*' 
syn match confNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' 
syn match confNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' 
syn match confNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' 
syn match confNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' 

hi def link confClass   Type
hi def link confKey     Statement
hi def link confNumber  Constant

3. 打开后缀为conf的文件

vim *.conf


即可查看到,conf部分内容被高亮。


以上为我设置的,可以参考如下几个网址自己设置:


http://vim.wikia.com/wiki/Creating_your_own_syntax_files

http://yyq123.blogspot.com/2011/02/vim-syntax.html

http://www.cnblogs.com/plwang1990/p/4106695.html






©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页