Code highlighting - the equal sign in vim is not highlighted
世界只因有你
世界只因有你 2017-05-16 16:40:20
0
3
762

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.

世界只因有你
世界只因有你

reply all(3)
漂亮男人

The poster can try this solution and write his own syntax highlighting rules:

  1. Add syntax/python.vimfiles
  2. under the .vim folder
  3. Add the following content to the file:
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\<\<\="
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目录里),你可以看到作者对不同的高亮类型设置了不同的颜色。SpecialCharSpecialCharWhat 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.

  1. Open this test file: test.py and see if it works
a = 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
我想大声告诉你

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

仅有的幸福

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template