Closed skwde closed 2 years ago
One reason this might happen is if you do set iskeyword-=_
in your .vimrc.
If this is the case, you can fix the highlighting by setting syntax iskeyword
to the original value of iskeyword
, for example:
execute 'autocmd Syntax python syn iskeyword ' . &iskeyword
set iskeyword-=_
(This needs to be an autocmd because loading a syntax will clear the value of syn iskeyword
, so it needs to be run after the syntax has been loaded.)
I guess that syntax files are all meant to set their own syn iskeyword
. When it is not set, it defaults to the value of iskeyword
, and there doesn't seem to be a way for the user to set a default value for syn iskeyword
that's independent of the value of iskeyword
, or even to check if syn iskeyword
has already been set by the current syntax - so you have to do this autocmd for every single syntax file that doesn't explicitly set it.
Thanks for the explanation. This seems to work.
When using a builtin in a variable name it is wrongly highlighted.
Just try: