Partial syntax highlighting with Python and MacVim

MacVim is driving me crazy. The syntax is only partially highlighted. What I am missing - I do not understand.

For example, I x = 5 * 10


*

should emphasize, but it is not. ==

+

etc. do not stand out.

Also self

does not stand out. (Yes, this is not a keyword, but still).

It would be great if the arguments inside the dedicated function were highlighted too.

I am using one of the more popular python syntax scripts .

Adding let python_highlight_all = 1

to my .vimrc file also doesn't work.

+3


source to share


3 answers


This is what Python looks like to me in MacVim:

and in regular Vim:



Keywords and literals are highlighted, but other characters aren't. Are you seeing something different, or seeing the same thing but expecting to see something different?

0


source


Try to insert a ~/.vim/after/sytax/

file python.vim

containing both lines

syn match   pythonOperator  "\(+\|-\|=\|*\|/\|\.\|,\|;\|:\|<\|>\|!\|%\|\~\|&\|\^\||\)"
syn keyword pythonStatement self

      



I agree with Ferdinand Beyer that

highlighting function arguments is difficult, if not impossible, with syntax scripts.

0


source


I imported my vim settings from Linux machine to Mac and had problems with partial syntax highlighting. In the end it turned out to be an issue with the way the Mac terminal was displaying my vim color scheme. Try changing the color scheme :colo desert

to see if it fixes the problem.

0


source







All Articles