在VIM编辑器中,如何突出显示某些特定单词?(In VIM editor how can some specific words be always highlighted?)

编程入门 行业动态 更新时间:2024-10-17 02:57:57
在VIM编辑器中,如何突出显示某些特定单词?(In VIM editor how can some specific words be always highlighted?)

VOD这样的一些词语总是在VIM中突出显示。

我可以在此列表中添加一些我想要突出显示的自定义单词吗?

A few words such as TODO remain highlighted always in VIM.

Can I add some custom words to this list which I want to be highlighted always?

最满意答案

Todo是一个语法组 , :h group-name来检查详细信息。

如果要突出显示某些单词/文本,可以编辑语法文件,也可以创建自己的hi-groups ( :h highlight-groups )并添加匹配项。

例如:

你可以match todo /!Important!/让文字!Important! 以与TODO相同的方式突出显示。 要么:

hi! Important ctermbg=red guibg=red

这将创建一个名为Important的hi组。

然后你添加匹配:

:match Important /!Important!/

这将突出显示文字!Important! 以您在组中定义的方式。

您还可以在vimrc中添加这些行。

Todo is a syntax group, :h group-name to check detail.

If you want to make some words/text highlighted, you can either edit syntax file, or create your own hi-groups (:h highlight-groups) and add match.

For example:

You can do match todo /!Important!/ to let text !Important! to be highlighted in same way as TODO. Or:

hi! Important ctermbg=red guibg=red

this will create a hi-group called Important.

Then you add match:

:match Important /!Important!/

this will highlight text !Important! in the way you defined in the group.

You could also add those lines in your vimrc.

更多推荐

本文发布于:2023-08-04 10:34:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415223.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单词   器中   编辑   VIM   highlighted

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!