From 3c0160c432b24f3c9b313adddefeb4efd8b87e72 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 26 May 2026 07:40:52 +0800 Subject: [PATCH] vim-patch:dfdeba1: runtime(vim): Update base syntax, fix mismtatched :def return type Anchor the return type separator ':' with a lookbehind as the relevant nextgroup options use skipwhite. closes: vim/vim#20319 https://github.com/vim/vim/commit/dfdeba16d7930e4a1fb8cf0003656b13da8ffffc Co-authored-by: Doug Kearns --- runtime/syntax/vim.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 5cb4c12ee2..dfeca32955 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -507,7 +507,7 @@ syn match vim9LambdaParams contained \ "(\%(\" \ skipwhite nextgroup=vim9LambdaOperator \ contains=@vim9Continue,vimDefParam,vim9LambdaParen,vim9LambdaReturnType -syn region vim9LambdaReturnType contained start=")\@<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent +syn region vim9LambdaReturnType contained start=")\@1<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent syn region vim9LambdaBlock contained matchgroup=vimSep start="{" end="^\s*\zs}" contains=@vimDefBodyList syn match vim9LambdaOperatorComment contained "#.*" skipwhite skipempty nextgroup=@vimExprList,vim9LambdaBlock,vim9LambdaOperatorComment @@ -617,7 +617,7 @@ syn match vimDelfunction "\" skipwhite nextgroup=vimDelfunct " ===== syn region vimReturnType contained - \ start=":\%(\s\|\n\)\@=" + \ start=")\@1<=:\%(\s\|\n\)\@=" \ skip=+\n\s*\%(\\\|#\\ \)\|^\s*#\\ + \ end="$" \ matchgroup=vim9Comment @@ -684,7 +684,7 @@ if s:vim9script \ contains=vim9DefTypeParam syn region vim9MethodDefReturnType contained - \ start=":\%(\s\|\n\)\@=" + \ start=")\@1<=:\%(\s\|\n\)\@=" \ skip=+\n\s*\%(\\\|#\\ \)\|^\s*#\\ + \ end="$" \ matchgroup=vim9Comment @@ -812,7 +812,7 @@ if s:vim9script \ skipwhite skipnl nextgroup=vimDefComment,vim9AbstractDefReturnType,vimCommentError \ contains=vimDefParam,vim9Comment,vimFunctionParamEquals syn region vim9AbstractDefReturnType contained - \ start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]" + \ start=")\@1<=:\s" end="$" matchgroup=vim9Comment end="\ze[#"]" \ skipwhite skipnl nextgroup=vimDefComment,vimCommentError \ contains=vimTypeSep \ transparent