求个高亮c操作符的的语法文件

Vim、Emacs配置和使用
回复
头像
fanhe
帖子: 2357
注册时间: 2007-03-24 23:45

求个高亮c操作符的的语法文件

#1

帖子 fanhe » 2010-12-03 1:00

本来想自己写的,但发现各种嵌套和优先问题,实在是不好搞
不知道有没有现成的代码,默认的不知道操作符高亮
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 求个高亮c操作符的的语法文件

#2

帖子 eexpress » 2010-12-03 9:11

vim.org
你啊
● 鸣学
头像
fanhe
帖子: 2357
注册时间: 2007-03-24 23:45

Re: 求个高亮c操作符的的语法文件

#4

帖子 fanhe » 2010-12-04 17:22

最终还是自己搞定了,发现那个pattern还是不能用[]来math的,而要用\|来math,真那啥
语法暂时折腾到这里

代码: 全选

"===========================================================
"						自定义高亮
"===========================================================

syntax match mcLineContinue "\\$" contained

" 高亮宏定义
"syn region mcPreproc start="^#" end="*)\s+"
"syn match mcMacro "\<[A-Z][A-Z0-9_]*\>"
"hi def link mcMacro Constant

" 高亮函数
syn match mcFunction display "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1 contains=cLineContinue
hi def link mcFunction Function

" 高亮常数,以全大写分辨
syn match mcConstant display "\<[A-Z][A-Z0-9_]*\>" contains=mcFunction
hi def link mcConstant Constant

syn match mcOperator display "+\|-\|\*\|/\|%\|=\|<\|>\|&\||\|!\|\~\|\^\|\.\|?\|:" contains=cComment,cCommentL
hi link mcOperator Operator
回复