在VIM中突出显示#defined值 [英] Highlighting #defined value in VIM

查看:98
本文介绍了在VIM中突出显示#defined值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在定义XYZ的头文件中突出显示了XYZ.但是,在使用它的地方,XYZ不会突出显示.我该如何解决?

I have XYZ highlighted in the header file where I have defined XYZ. However at the point of where it is used, XYZ is not highlighted. How would I fix this ?

我附上了两个屏幕截图(请参见代码TH_SYN)以澄清我的问题-

I have attached two screen shots (see TH_SYN in the code) to clarify my question-

链接文本

欢迎使用任何指针.

推荐答案

基于所有常量都是带下划线的大写字母,我为Java常量(静态最终)做了一种非常粗略的方法.几乎没有其他标识符符合该条件.

I have done a very crude way of doing this for Java constants (static finals), based on the fact that all constants, are all caps with underbars. Almost no other identifiers match that criteria.

因此,非常简单,非常快速但并非100%准确的是将所有大写字母与您定义的相同语法组进行匹配.

So a very simple, and very fast, but not 100% accurate is to match all caps to the same syntax group as your defines.

编辑.添加样本

在您的语言语法文件中,添加以下内容:

In your language syntax file just add something like:

syn match defined "[A-Z][A-Z0-9_]*" 
HiLink defined Type

您可以对Constant或任何您喜欢的已定义突出显示组进行HiLink.

You can do HiLink to Constant, or any of the defined highlight groups you like.

这篇关于在VIM中突出显示#defined值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆