diff options
Diffstat (limited to 'runtime/syntax/python.vim')
| -rw-r--r-- | runtime/syntax/python.vim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 2382690531..eb1be624fd 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -313,6 +313,8 @@ if !exists("python_no_builtin_highlight") syn match pythonAttribute /\.\h\w*/hs=s+1 \ contains=ALLBUT,pythonBuiltin,pythonClass,pythonFunction,pythonType,pythonAsync \ transparent + " the ellipsis literal `...` can be used in multiple syntactic contexts + syn match pythonEllipsis "\.\@1<!.\.\.\ze\.\@!" display endif " From the 'Python Library Reference' class hierarchy at the bottom. @@ -368,10 +370,12 @@ if !exists("python_no_doctest_highlight") if !exists("python_no_doctest_code_highlight") syn region pythonDoctest \ start="^\s*>>>\s" end="^\s*$" - \ contained contains=ALLBUT,pythonDoctest,pythonClass,pythonFunction,pythonType,@Spell + \ contained contains=ALLBUT,pythonDoctest,pythonEllipsis,pythonClass,pythonFunction,pythonType,@Spell syn region pythonDoctestValue \ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$" - \ contained + \ contained contains=pythonEllipsis + syn match pythonEllipsis "\%(^\s*\)\@<!\.\@1<!\zs\.\.\.\ze\.\@!" display + \ contained containedin=pythonDoctest else syn region pythonDoctest \ start="^\s*>>>" end="^\s*$" @@ -414,6 +418,7 @@ if !exists("python_no_number_highlight") endif if !exists("python_no_builtin_highlight") hi def link pythonBuiltin Function + hi def link pythonEllipsis pythonBuiltin endif if !exists("python_no_exception_highlight") hi def link pythonExceptions Structure |