班级在 Vim 中高亮显示函数名称 [英] class & function names highlighting in Vim

查看:27
本文介绍了班级在 Vim 中高亮显示函数名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在对它的模态输入上瘾之后,我最近刚刚从 Textmate 设置了我的 Vim 环境.

I just recently set up my Vim environment from Textmate, after becoming addicted to its modal input.

然而,语法高亮在 Vim 中似乎没有那么漂亮.我用 C++ 编写代码,由于无法突出显示函数调用和类名,因此代码更难阅读.我玩了一会儿配色方案,但找不到任何与类名"或函数名"相对应的字段.

However, syntax highlighting seems to be not so beautiful in Vim. I code in C++ and since the function call and class names can't be highlighted, the code is more difficult to read. I played with color scheme for a bit, but couldn't find any field that corresponded to "class name" or "function name".

在下图中,注意 DroughtLayer::*.size() 在 MacVim 的右侧没有突出显示.

In the picture below, notice how DroughtLayer:: and *.size() is not highlighted on the right in MacVim.


(来源:ivzhao.com)

任何想法如何解决这个问题?这真的让我很恼火,因为我是一个对视觉非常敏感的人.

Any ideas how to solve this? It really annoys me as I am so much a visual-sensitive guy.

推荐答案

有趣的是,VIM 中的语法高亮器不支持将语法应用于标识符或函数名称——至少不支持 C 和 C++ 的语法高亮器.所以,即使你这样做:

Interestingly, the syntax highlighters in VIM don't support applying a syntax to identifiers or function names - at least not the syntax highlighters for C and C++. So, even if you do:

:hi Function guifg=red

:hi Identifier guifg=red

它没有给这些颜色.我似乎只是这些语言的关键字和常量.

it doesn't give these a color. I just seems to be not much more than keywords and constants for these languages.

这里,有人开始扩展 cpp 语法文件以支持方​​法名称.我想这是一个开始.http://vim.wikia.com/wiki/Highlighting_of_method_names_in_the_definition

Here, someone has started extending the cpp syntax file to support method names. It's a start I guess. http://vim.wikia.com/wiki/Highlighting_of_method_names_in_the_definition

这篇关于班级在 Vim 中高亮显示函数名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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