diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 320fd785c7..e963155d4a 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,10 +1,11 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic -" Last Change: 2025 Aug 18 +" Last Change: 2025 Aug 23 " Credits: Neil Schemenauer " Dmitry Vasiliev " Rob B +" Jon Parise " " This version is a major rewrite by Zvezdan Petkovic. " @@ -112,6 +113,7 @@ syn keyword pythonAsync async await " for more on this. syn match pythonConditional "^\s*\zscase\%(\s\+.*:.*$\)\@=" syn match pythonConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@=" +syn match pythonStatement "\>>\|\.\.\.\)\s\+\)\=\zs\%(\h\|\%(\h\|[[(]\).\{-}\%(\w\|[])]\)\)\s*\n\%(\s*\.\.\.\s\)\=\s\+@\%(.\{-}\n\%(\s*\.\.\.\s\)\=\s\+@\)*" - \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonClass,pythonFunction,pythonDoctestValue + \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonClass,pythonFunction,pythonType,pythonDoctestValue \ transparent syn match pythonClass "\h\w*" display contained syn match pythonFunction "\h\w*" display contained +syn match pythonType "\h\w*" display contained syn match pythonComment "#.*$" contains=pythonTodo,@Spell syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained @@ -300,10 +303,12 @@ if !exists("python_no_builtin_highlight") syn keyword pythonBuiltin memoryview min next object oct open ord pow syn keyword pythonBuiltin print property range repr reversed round set syn keyword pythonBuiltin setattr slice sorted staticmethod str sum super - syn keyword pythonBuiltin tuple type vars zip __import__ + syn keyword pythonBuiltin tuple vars zip __import__ + " only match `type` as a builtin when it's not followed by an identifier + syn match pythonBuiltin "\>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$" \ contained @@ -387,6 +392,7 @@ hi def link pythonDecorator Define hi def link pythonDecoratorName Function hi def link pythonClass Structure hi def link pythonFunction Function +hi def link pythonType Type hi def link pythonComment Comment hi def link pythonTodo Todo hi def link pythonString String