Skip to content

Commit aacf27d

Browse files
committed
Implement option to disable highlighting builtin functions as kwarg
Fixes vim-python#17
1 parent 4531620 commit aacf27d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ let g:python_highlight_all = 1
6262
| `g:python_highlight_builtins` | Highlight builtin functions and objects | `0` |
6363
| `g:python_highlight_builtin_objs` | Highlight builtin objects only | `0` |
6464
| `g:python_highlight_builtin_funcs` | Highlight builtin functions only | `0` |
65+
| `g:python_highlight_builtin_funcs_kwarg` | Highlight builtin functions when used as kwarg | `1` |
6566
| `g:python_highlight_exceptions` | Highlight standard exceptions | `0` |
6667
| `g:python_highlight_string_formatting` | Highlight `%` string formatting | `0` |
6768
| `g:python_highlight_string_format` | Highlight syntax of `str.format` syntax | `0` |

doc/python-syntax.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ following command to your `~/.config/nvim/init.vim` or `~/.vimrc`: >
6565
`g:python_highlight_builtin_funcs` (default `0`)
6666
Highlight builtin functions only
6767

68+
`g:python_highlight_builtin_funcs_kwarg` (default `1`)
69+
Highlight builtin functions when used as kwarg
70+
6871
`g:python_highlight_exceptions` (default `0`)
6972
Highlight standard exceptions
7073

syntax/python.vim

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ endfunction
3737
"
3838

3939
call s:EnableByDefault('g:python_slow_sync')
40+
call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg')
4041

4142
if s:Enabled('g:python_highlight_all')
4243
call s:EnableByDefault('g:python_highlight_builtins')
@@ -352,7 +353,13 @@ if s:Enabled('g:python_highlight_builtin_funcs')
352353
let s:funcs_re .= '|ascii|exec|print'
353354
endif
354355

355-
execute 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'''
356+
let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'
357+
358+
if !s:Enabled('g:python_highlight_builtin_funcs_kwarg')
359+
let s:funcs_re .= '\=@!'
360+
endif
361+
362+
execute s:funcs_re . ''''
356363
unlet s:funcs_re
357364
endif
358365

0 commit comments

Comments
 (0)