Skip to content

Commit bbed018

Browse files
author
Michael Doronin
committed
keyword arguments and optional parameters are only highlighted inside
actual function calls and function defenitions
1 parent bd24b62 commit bbed018

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

syntax/python.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ syn keyword pythonException try except finally
170170
syn keyword pythonOperator and in is not or
171171

172172
syn match pythonStatement "^\s*yield\>" display
173+
syn match pythonIdentifier "[a-zA-Z_][a-zA-Z0-9_]*" nextgroup=FunctionParameters display
173174

174175
if s:Python2Syntax()
175176
if !s:Enabled("g:python_print_as_function")
@@ -180,7 +181,7 @@ if s:Python2Syntax()
180181
else
181182
syn keyword pythonStatement as nonlocal
182183
syn match pythonStatement "\<yield\s\+from\>" display
183-
syn match pythonFunction "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
184+
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" nextgroup=FunctionParameters display contained
184185
syn keyword pythonStatement await
185186
syn match pythonStatement "\<async\s\+def\>" nextgroup=pythonFunction skipwhite
186187
syn match pythonStatement "\<async\s\+with\>" display
@@ -195,7 +196,6 @@ syn region FunctionParameters start='(' end=')' display contains=
195196
\ pythonClassVaraible,
196197
\ pythonConditional,
197198
\ pythonComment,
198-
\ pythonImport,
199199
\ pythonOperator,
200200
\ pythonNumber,
201201
\ pythonNumberError,
@@ -214,7 +214,7 @@ syn region FunctionParameters start='(' end=')' display contains=
214214
\ pythonBuiltinObj,
215215
\ pythonBuiltinFunc,
216216
\ pythonBoolean
217-
\ nextgroup=OptionalParameters
217+
\ nextgroup=OptionalParameters display contained
218218
syn match OptionalParameters /\i*\ze=/ display contained
219219
"
220220
" Decorators (new in Python 2.4)

0 commit comments

Comments
 (0)