diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2025-09-09 12:40:12 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-09 12:40:12 +0800 |
| commit | d15936f6ef9b6d225b92d93369efaf2b1bb37474 (patch) | |
| tree | 6c4caea9e3d83c3dd1b5c7fd135fc794f6fda085 /runtime/syntax/python.vim | |
| parent | eb19206e032a9798e68de1d76f02e568d8e076f4 (diff) | |
| parent | 12868474db6fe7e4c3a1494bac26c8b0799393a3 (diff) | |
Merge pull request #35693 from zeertzjq/vim-6bb16d2
vim-patch: Python syntax updates
Diffstat (limited to 'runtime/syntax/python.vim')
| -rw-r--r-- | runtime/syntax/python.vim | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index b2f866b8b3..eb1be624fd 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic <zpetkovic@acm.org> -" Last Change: 2025 Sep 05 +" Last Change: 2025 Sep 08 " Credits: Neil Schemenauer <nas@python.ca> " Dmitry Vasiliev " Rob B @@ -271,7 +271,7 @@ if !exists("python_no_number_highlight") syn match pythonNumber \ "\<\d\%(_\=\d\)*\.\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\%(\W\|$\)\@=" syn match pythonNumber - \ "\%(^\|\W\)\zs\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\>" + \ "\%(^\|\W\)\@1<=\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\>" endif " Group the built-ins in the order in the 'Python Library Reference' for @@ -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 |
