mirror of
https://github.com/vim-python/python-syntax.git
synced 2025-12-07 21:24:52 +08:00
Implement option to disable highlighting builtin functions as kwarg
Fixes #17
This commit is contained in:
@@ -62,6 +62,7 @@ let g:python_highlight_all = 1
|
|||||||
| `g:python_highlight_builtins` | Highlight builtin functions and objects | `0` |
|
| `g:python_highlight_builtins` | Highlight builtin functions and objects | `0` |
|
||||||
| `g:python_highlight_builtin_objs` | Highlight builtin objects only | `0` |
|
| `g:python_highlight_builtin_objs` | Highlight builtin objects only | `0` |
|
||||||
| `g:python_highlight_builtin_funcs` | Highlight builtin functions only | `0` |
|
| `g:python_highlight_builtin_funcs` | Highlight builtin functions only | `0` |
|
||||||
|
| `g:python_highlight_builtin_funcs_kwarg` | Highlight builtin functions when used as kwarg | `1` |
|
||||||
| `g:python_highlight_exceptions` | Highlight standard exceptions | `0` |
|
| `g:python_highlight_exceptions` | Highlight standard exceptions | `0` |
|
||||||
| `g:python_highlight_string_formatting` | Highlight `%` string formatting | `0` |
|
| `g:python_highlight_string_formatting` | Highlight `%` string formatting | `0` |
|
||||||
| `g:python_highlight_string_format` | Highlight syntax of `str.format` syntax | `0` |
|
| `g:python_highlight_string_format` | Highlight syntax of `str.format` syntax | `0` |
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ following command to your `~/.config/nvim/init.vim` or `~/.vimrc`: >
|
|||||||
`g:python_highlight_builtin_funcs` (default `0`)
|
`g:python_highlight_builtin_funcs` (default `0`)
|
||||||
Highlight builtin functions only
|
Highlight builtin functions only
|
||||||
|
|
||||||
|
`g:python_highlight_builtin_funcs_kwarg` (default `1`)
|
||||||
|
Highlight builtin functions when used as kwarg
|
||||||
|
|
||||||
`g:python_highlight_exceptions` (default `0`)
|
`g:python_highlight_exceptions` (default `0`)
|
||||||
Highlight standard exceptions
|
Highlight standard exceptions
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ endfunction
|
|||||||
"
|
"
|
||||||
|
|
||||||
call s:EnableByDefault('g:python_slow_sync')
|
call s:EnableByDefault('g:python_slow_sync')
|
||||||
|
call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg')
|
||||||
|
|
||||||
if s:Enabled('g:python_highlight_all')
|
if s:Enabled('g:python_highlight_all')
|
||||||
call s:EnableByDefault('g:python_highlight_builtins')
|
call s:EnableByDefault('g:python_highlight_builtins')
|
||||||
@@ -352,7 +353,13 @@ if s:Enabled('g:python_highlight_builtin_funcs')
|
|||||||
let s:funcs_re .= '|ascii|exec|print'
|
let s:funcs_re .= '|ascii|exec|print'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
execute 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'''
|
let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'
|
||||||
|
|
||||||
|
if !s:Enabled('g:python_highlight_builtin_funcs_kwarg')
|
||||||
|
let s:funcs_re .= '\=@!'
|
||||||
|
endif
|
||||||
|
|
||||||
|
execute s:funcs_re . ''''
|
||||||
unlet s:funcs_re
|
unlet s:funcs_re
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user