Dear all and Mr. Zvezdan Petkovic,
I introduce python_no_python{2,3}_builtin_highlight to avoid highlighting the
buitlins only in Python 2/3, like c_no_c99 in syntax/c.vim.
The variable names are lengthy, though.
Best Regards,
--
Eisuke Kawashima
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim
index 23666a1..1c38fc9 100644
--- a/runtime/syntax/python.vim
+++ b/runtime/syntax/python.vim
@@ -210,13 +210,19 @@ if !exists("python_no_builtin_highlight")
syn keyword pythonBuiltin setattr slice sorted staticmethod str
syn keyword pythonBuiltin sum super tuple type vars zip __import__
" Python 2 only
- syn keyword pythonBuiltin basestring cmp execfile file
- syn keyword pythonBuiltin long raw_input reduce reload unichr
- syn keyword pythonBuiltin unicode xrange
+ if !exists("python_no_python2_builtin_highlight")
+ syn keyword pythonBuiltin basestring cmp execfile file
+ syn keyword pythonBuiltin long raw_input reduce reload unichr
+ syn keyword pythonBuiltin unicode xrange
+ endif
" Python 3 only
- syn keyword pythonBuiltin ascii bytes exec
+ if !exists("python_no_python3_builtin_highlight")
+ syn keyword pythonBuiltin ascii bytes exec
+ endif
" non-essential built-in functions; Python 2 only
- syn keyword pythonBuiltin apply buffer coerce intern
+ if !exists("python_no_python2_builtin_highlight")
+ syn keyword pythonBuiltin apply buffer coerce intern
+ endif
" avoid highlighting attributes as builtins
syn match pythonAttribute /\.\h\w*/hs=s+1
\ contains=ALLBUT,pythonBuiltin,pythonFunction,pythonAsync
@@ -232,7 +238,9 @@ if !exists("python_no_exception_highlight")
syn keyword pythonExceptions ArithmeticError BufferError
syn keyword pythonExceptions LookupError
" builtin base exceptions removed in Python 3
- syn keyword pythonExceptions EnvironmentError StandardError
+ if !exists("python_no_python2_builtin_highlight")
+ syn keyword pythonExceptions EnvironmentError StandardError
+ endif
" builtin exceptions (actually raised)
syn keyword pythonExceptions AssertionError AttributeError
syn keyword pythonExceptions EOFError FloatingPointError GeneratorExit
@@ -247,24 +255,30 @@ if !exists("python_no_exception_highlight")
syn keyword pythonExceptions UnicodeTranslateError ValueError
syn keyword pythonExceptions ZeroDivisionError
" builtin OS exceptions in Python 3
- syn keyword pythonExceptions BlockingIOError BrokenPipeError
- syn keyword pythonExceptions ChildProcessError ConnectionAbortedError
- syn keyword pythonExceptions ConnectionError ConnectionRefusedError
- syn keyword pythonExceptions ConnectionResetError FileExistsError
- syn keyword pythonExceptions FileNotFoundError InterruptedError
- syn keyword pythonExceptions IsADirectoryError NotADirectoryError
- syn keyword pythonExceptions PermissionError ProcessLookupError
- syn keyword pythonExceptions RecursionError StopAsyncIteration
- syn keyword pythonExceptions TimeoutError
+ if !exists("python_no_python3_builtin_highlight")
+ syn keyword pythonExceptions BlockingIOError BrokenPipeError
+ syn keyword pythonExceptions ChildProcessError ConnectionAbortedError
+ syn keyword pythonExceptions ConnectionError ConnectionRefusedError
+ syn keyword pythonExceptions ConnectionResetError FileExistsError
+ syn keyword pythonExceptions FileNotFoundError InterruptedError
+ syn keyword pythonExceptions IsADirectoryError NotADirectoryError
+ syn keyword pythonExceptions PermissionError ProcessLookupError
+ syn keyword pythonExceptions RecursionError StopAsyncIteration
+ syn keyword pythonExceptions TimeoutError
+ endif
" builtin exceptions deprecated/removed in Python 3
- syn keyword pythonExceptions IOError VMSError WindowsError
+ if !exists("python_no_python2_builtin_highlight")
+ syn keyword pythonExceptions IOError VMSError WindowsError
+ endif
" builtin warnings
syn keyword pythonExceptions BytesWarning DeprecationWarning FutureWarning
syn keyword pythonExceptions ImportWarning PendingDeprecationWarning
syn keyword pythonExceptions RuntimeWarning SyntaxWarning UnicodeWarning
syn keyword pythonExceptions UserWarning Warning
" builtin warnings in Python 3
- syn keyword pythonExceptions ResourceWarning
+ if !exists("python_no_python3_builtin_highlight")
+ syn keyword pythonExceptions ResourceWarning
+ endif
endif
if exists("python_space_error_highlight")