Reputation: 107
Title of the question pretty much describes the problem
In my vimrc file i even typed this:
let python_highlight_all = 0
But this does not help at all
UPD: I got it to work with monkeypatch in python.vim. I just commented this line:
syn match pythonSpaceError display excludenl "\s\+$"
If someone has a better solution please answer
Upvotes: 4
Views: 2069
Reputation: 11656
If you're using python-mode, you can set this option in your ~/.vimrc
:
let g:pymode_syntax_space_errors = 0
Upvotes: 0
Reputation: 21
I still wanted the other highlights enabled by python_highlight_all
and found that the option to disable this is actually called python_highlight_space_errors
not python_space_error_highlight
. This worked for me:
let python_highlight_all = 1
let python_highlight_space_errors = 0
Upvotes: 0
Reputation: 693
Here are at least 2 possible reasons for this:
python_highlight_all
is definedpython_space_error_highlight
is definedSince the problem is gone if you monkeypatch syntax/python.vim
this highlight should be coming from Vim's default Python syntax file.
In the syntax file, the highlight is controlled by the code below:
# vim80/syntax/python.vim
if exists("python_highlight_all")
...
let python_space_error_highlight = 1
endif
With this code, python_space_error_highlight
is enabled if a variable python_highlight_all
exists regardless of its value.
So probably python_highlight_all
and/or python_space_error_highlight
is defined somewhere.
How's the result if you add the code below to your vimrc?
if exists('python_highlight_all')
unlet python_highlight_all
endif
if exists('python_space_error_highlight')
unlet python_space_error_highlight
endif
Upvotes: 6
Reputation: 172510
In $VIMRUNTIME/syntax/python.vim
, the pythonSpaceError
syntax group is surrounded by an if exists("python_space_error_highlight")
conditional (in Vim 8.0; using a syntax file from 2016 Oct 29).
So, there's no need to monkey-patch, you can indeed turn this off, by defining neither python_space_error_highlight
nor python_highlight_all
(because the latter definition will automatically define the former, too).
(Even when a config value is 0
, as the script just tests for the existence of the variable (which is odd and against the usual convention; you may want to complain about this to the script's author). Therefore, ensure that you don't have of those config variables set, and it should work.
Upvotes: 5
Reputation: 4031
let g:python_highlight_all = 0
A string search in the following script gave me that answer
https://github.com/hdima/python-syntax/tree/master/syntax
Upvotes: 0