Win32, gvim, version 7.4, python highlight. How to highlight the equal sign, code highlight is no problem, just like the equal sign it does not highlight, should not be a color theme problem.
Thank you for your answer, your method can be highlighted.
I don’t know what’s going on. I can’t change the. vim file. entering those commands in the window is only effective.
Finally, it was clear that what I modified was the python.vim highlight file under the vim installation directory.
While I installed bundle and python-syntax, the default load is python.vim under python-syntax.
Therefore, the modification is invalid.
The landlord can try this scheme and write his own grammar highlighting rules:
- Add under. vim folder
syntax/python.vim
File- Add the following 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 grammar group calledpythonOperator
Andhighlight link pythonOperator SpecialChar
Let this grammar group match the content withSpecialChar
Highlight type.SpecialChar
What does highlight type mean? Open your color scheme (usually in.vim/bundle
You can see that the author has set different colors for different highlight types.SpecialChar
Is one of them.
- Open this test file:
test.py
, and see if it is effectivea = 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