diff --git a/README.md b/README.md index 6b65699..8c35ec2 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ let g:python_highlight_all = 1 | `g:python_highlight_builtins` | Highlight builtin functions and objects | `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_kwarg` | Highlight builtin functions when used as kwarg | `1` | | `g:python_highlight_exceptions` | Highlight standard exceptions | `0` | | `g:python_highlight_string_formatting` | Highlight `%` string formatting | `0` | | `g:python_highlight_string_format` | Highlight syntax of `str.format` syntax | `0` | diff --git a/doc/python-syntax.txt b/doc/python-syntax.txt index f310e7a..a1ccf16 100644 --- a/doc/python-syntax.txt +++ b/doc/python-syntax.txt @@ -65,6 +65,9 @@ following command to your `~/.config/nvim/init.vim` or `~/.vimrc`: > `g:python_highlight_builtin_funcs` (default `0`) 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`) Highlight standard exceptions diff --git a/syntax/python.vim b/syntax/python.vim index 7cb55ca..3ea261c 100644 --- a/syntax/python.vim +++ b/syntax/python.vim @@ -37,6 +37,7 @@ endfunction " call s:EnableByDefault('g:python_slow_sync') +call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg') if s:Enabled('g:python_highlight_all') 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' endif - execute 'syn match pythonBuiltinFunc ''\v\.@''' + let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@' + + if !s:Enabled('g:python_highlight_builtin_funcs_kwarg') + let s:funcs_re .= '\=@!' + endif + + execute s:funcs_re . '''' unlet s:funcs_re endif