]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(python): Also sync syntax at 'async def'
authorJon Parise <jon@indelible.org>
Mon, 11 Aug 2025 18:33:33 +0000 (20:33 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 11 Aug 2025 18:33:33 +0000 (20:33 +0200)
A file containing only async functions (`async def func()`) wouldn't
previously match the pythonSync pattern.

Also, this pattern only matches at the beginning of the line, so it
won't ever match method definitions (which are indented within class
scopes). Update the comment accordingly.

closes: #17963

Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Zvezdan Petkovic <zpetkovic@acm.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/python.vim

index d123ba4f84c85a56c5464bf9a1595f440b822310..cc62babbfabb889f6dc439d296f15e97bafaa48e 100644 (file)
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:    Python
 " Maintainer:  Zvezdan Petkovic <zpetkovic@acm.org>
-" Last Change: 2025 Aug 10
+" Last Change: 2025 Aug 11
 " Credits:     Neil Schemenauer <nas@python.ca>
 "              Dmitry Vasiliev
 "              Rob B
@@ -367,8 +367,8 @@ if !exists("python_no_doctest_highlight")
   endif
 endif
 
-" Sync at the beginning of class, function, or method definition.
-syn sync match pythonSync grouphere NONE "^\%(def\|class\)\s\+\h\w*\s*[(:]"
+" Sync at the beginning of (async) function or class definitions.
+syn sync match pythonSync grouphere NONE "^\%(async\s\+def\|def\|class\)\s\+\h\w*\s*[(:]"
 
 " The default highlight links.  Can be overridden later.
 hi def link pythonStatement            Statement