is win32, gvim, version 7.4, with python highlighting. How to highlight the equal sign? There is no problem with code highlighting. It’s just that the equal sign is not highlighted. It shouldn’t be a problem with the color theme.
Thank you for your answers, your method can be highlighted.
I don’t know what’s going on, but I can’t change the .vim file. It only works if I enter those commands in the window.
I finally figured it out. What I modified was the python.vim highlight file in the vim installation directory,
And I installed bundle and python-syntax, and the default loaded is python.vim under python-syntax,
So the modification is invalid.
漂亮男人2017-05-16 16:42:20
The poster can try this solution and write his own syntax highlighting rules:
syntax/python.vim
filessyntax match pythonOperator "\v\="
syntax match pythonOperator "\v\*\="
syntax match pythonOperator "\v/\="
syntax match pythonOperator "\v\+\="
syntax match pythonOperator "\v-\="
syntax match pythonOperator "\v\%\="
syntax match pythonOperator "\v\&\="
syntax match pythonOperator "\v\|\="
syntax match pythonOperator "\v\!\="
syntax match pythonOperator "\v\>\="
syntax match pythonOperator "\v\<\="
syntax match pythonOperator "\v\=\="
syntax match pythonOperator "\v//\="
syntax match pythonOperator "\v\^\="
syntax match pythonOperator "\v\>\>\="
syntax match pythonOperator "\v\<\<\="
syntax match pythonOperator "\v\*\*\="
highlight link pythonOperator SpecialChar
Explanation:
syntax match creates a syntax group called pythonOperator
And highlight link pythonOperator SpecialChar
allows the content matched by this syntax group to have the SpecialChar
highlight type. highlight link pythonOperator SpecialChar
让这个语法组匹配的内容都带有SpecialChar
高亮类型。SpecialChar
高亮类型是什么意思呢? 打开你的配色主题方案(一般在.vim/bundle
的同名文件夹下的colors目录里),你可以看到作者对不同的高亮类型设置了不同的颜色。SpecialChar
SpecialChar
What does the highlight type mean? Open your color theme scheme (usually in the colors directory under the same name folder of .vim/bundle
), you can see that the author has set different colors for different highlight types. SpecialChar
is one of them.
test.py
and see if it worksa = 1
b = 2
a += b
a -= b
a *= b
a /= b
a %= b
a **= b
a == b
a >= b
a <= b
a != b
a >>= b
a <<= b
a &= b
a |= b
a //= b
我想大声告诉你2017-05-16 16:42:20
The highlighting mentioned by the questioner is grammar color matching?
This website can visually create vim color matching files http://bytefluent.com/vivify
You can try it hi Operator ctermfg=red guifg=red
仅有的幸福2017-05-16 16:42:20
Depending on what code you want to highlight, you can install the corresponding plug-in according to the language.
Or try a different color scheme.