From d395dc9d38fe7d9751ebf599ca21d7a6f54f03f3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 11 Aug 2025 07:00:15 +0800 Subject: [PATCH 1/3] vim-patch:7270a5a: runtime(racket): update Racket runtime files This brings the upstream files to commit 9dc3bd3 (ftplugin: escape Vim special characters when opening docs, 2025-08-09). Note that not all upstream files are included. closes: vim/vim#17956 https://github.com/vim/vim/commit/7270a5a8431e0209043f14dd3fa3ea479e4cddc6 Co-authored-by: D. Ben Knoble --- runtime/ftplugin/racket.vim | 4 ++-- runtime/indent/racket.vim | 5 +++-- runtime/syntax/racket.vim | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/runtime/ftplugin/racket.vim b/runtime/ftplugin/racket.vim index 52768d67f5..b8004a93af 100644 --- a/runtime/ftplugin/racket.vim +++ b/runtime/ftplugin/racket.vim @@ -3,7 +3,7 @@ " Maintainer: D. Ben Knoble " Previous Maintainer: Will Langstroth " URL: https://github.com/benknoble/vim-racket -" Last Change: 2024 Jun 01 +" Last Change: 2025 Aug 09 if exists("b:did_ftplugin") finish @@ -39,7 +39,7 @@ if !exists("no_plugin_maps") && !exists("no_racket_maps") " "press ENTER or type a command to continue" " We avoid the annoyance of having to hit enter by remapping K directly. function s:RacketDoc(word) abort - execute 'silent !raco docs --' shellescape(a:word) + execute 'silent !raco docs --' shellescape(a:word, v:true) redraw! endfunction nnoremap RacketDoc :call RacketDoc(expand('')) diff --git a/runtime/indent/racket.vim b/runtime/indent/racket.vim index 2bab3f3bed..d978970d59 100644 --- a/runtime/indent/racket.vim +++ b/runtime/indent/racket.vim @@ -3,7 +3,7 @@ " Maintainer: D. Ben Knoble " Previous Maintainer: Will Langstroth " URL: https://github.com/benknoble/vim-racket -" Last Change: 2024 Nov 12 +" Last Change: 2025 Aug 09 if exists("b:did_indent") finish @@ -16,6 +16,7 @@ if has('vim9script') endif setlocal lispwords+=module,module*,module+,parameterize,parameterize*,let-values,let*-values,letrec-values,local +setlocal lispwords+=splicing-let,splicing-letrec,splicing-let-values,splicing-letrec-values,splicing-local,splicing-parameterize setlocal lispwords+=define/contract setlocal lispwords+=λ setlocal lispwords+=with-handlers @@ -50,7 +51,7 @@ setlocal lispwords+=fresh,run,run*,project,conde,condu " loops setlocal lispwords+=for,for/list,for/fold,for*,for*/list,for*/fold,for/or,for/and,for*/or,for*/and -setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/flvector,for/vector,for*/vector,for*/sum,for*/hash,for*/hasheq,for*/hasheqv +setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/flvector,for/vector,for*/vector,for/fxvector,for*/fxvector,for*/sum,for*/hash,for*/hasheq,for*/hasheqv setlocal lispwords+=for/async setlocal lispwords+=for/set,for*/set setlocal lispwords+=for/first,for*/first diff --git a/runtime/syntax/racket.vim b/runtime/syntax/racket.vim index 7dcca6082c..e9b70a1b0c 100644 --- a/runtime/syntax/racket.vim +++ b/runtime/syntax/racket.vim @@ -4,7 +4,7 @@ " Previous Maintainer: Will Langstroth " URL: https://github.com/benknoble/vim-racket " Description: Contains all of the keywords in #lang racket -" Last Change: 2024 Apr 14 +" Last Change: 2025 Aug 09 " Initializing: if exists("b:current_syntax") @@ -534,21 +534,21 @@ syntax match racketContainedNumberError "\<#[ei]#[ei]" syntax match racketContainedNumberError "\<#[xdob]#[xdob]" " start with the simpler sorts -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\d\+/\d\+\>" contains=racketContainedNumberError syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\d\+/\d\+[-+]\d\+\(/\d\+\)\?i\>" contains=racketContainedNumberError " different possible ways of expressing complex values -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?[-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f][-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?[-+]\(inf\|nan\)\.[0f]i\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?@[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f]@[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?@[-+]\(inf\|nan\)\.[0f]\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?[-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f][-+]\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?i\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?[-+]\(inf\|nan\)\.[0f]i\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?@[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdlef][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f]@[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[dobie]\)\{0,2}[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?\([sdleft][-+]\?\d\+#*\)\?@[-+]\(inf\|nan\)\.[0f]\>" contains=racketContainedNumberError " hex versions of the above (separate because of the different possible exponent markers) -syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?\>" +syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([slt][-+]\?\x\+#*\)\?\>" syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\x\+/\x\+\>" syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\x\+/\x\+[-+]\x\+\(/\x\+\)\?i\>" @@ -561,9 +561,9 @@ syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\(inf\|nan\)\.[0f]@[ syntax match racketNumber "\<\(#x\|#[ei]#x\|#x#[ei]\)[-+]\?\(\x\+\|\x\+#*\.\|\x*\.\x\+\)#*\(/\x\+#*\)\?\([sl][-+]\?\x\+#*\)\?@[-+]\(inf\|nan\)\.[0f]\>" " these work for any radix -syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f]i\?\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f][-+]\(inf\|nan\)\.[0f]i\>" contains=racketContainedNumberError -syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0f]@[-+]\(inf\|nan\)\.[0f]\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0ft]i\?\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0ft][-+]\(inf\|nan\)\.[0f]i\>" contains=racketContainedNumberError +syntax match racketNumber "\<\(#[xdobie]\)\{0,2}[-+]\(inf\|nan\)\.[0ft]@[-+]\(inf\|nan\)\.[0f]\>" contains=racketContainedNumberError syntax keyword racketBoolean #t #f #true #false #T #F From 82a54a772be64c75412ee02b67f2d9318d675387 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 11 Aug 2025 07:00:35 +0800 Subject: [PATCH 2/3] vim-patch:48b7eb1: runtime(python): Highlight classes as structures Class and function definitions previously shared a single highlight group (pythonFunction). This change gives classes their own highlight group (pythonClass) that's linked to Structure. closes: vim/vim#17856 https://github.com/vim/vim/commit/48b7eb1ceb16527640ce5853d876c432d7342532 Co-authored-by: Jon Parise --- runtime/syntax/python.vim | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index dfebf547b1..c13efc07e2 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic -" Last Change: 2025 Jul 17 +" Last Change: 2025 Jul 26 " Credits: Neil Schemenauer " Dmitry Vasiliev " Rob B @@ -97,7 +97,8 @@ endif syn keyword pythonStatement False None True syn keyword pythonStatement as assert break continue del global syn keyword pythonStatement lambda nonlocal pass return with yield -syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite +syn keyword pythonStatement class nextgroup=pythonClass skipwhite +syn keyword pythonStatement def nextgroup=pythonFunction skipwhite syn keyword pythonConditional elif else if syn keyword pythonRepeat for while syn keyword pythonOperator and in is not or @@ -123,20 +124,21 @@ syn match pythonDecoratorName "@\s*\h\%(\w\|\.\)*" display contains=pythonDeco " Single line multiplication. syn match pythonMatrixMultiply \ "\%(\w\|[])]\)\s*@" - \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue + \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonClass,pythonFunction,pythonDoctestValue \ transparent " Multiplication continued on the next line after backslash. syn match pythonMatrixMultiply \ "[^\\]\\\s*\n\%(\s*\.\.\.\s\)\=\s\+@" - \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue + \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonClass,pythonFunction,pythonDoctestValue \ transparent " Multiplication in a parenthesized expression over multiple lines with @ at " the start of each continued line; very similar to decorators and complex. syn match pythonMatrixMultiply \ "^\s*\%(\%(>>>\|\.\.\.\)\s\+\)\=\zs\%(\h\|\%(\h\|[[(]\).\{-}\%(\w\|[])]\)\)\s*\n\%(\s*\.\.\.\s\)\=\s\+@\%(.\{-}\n\%(\s*\.\.\.\s\)\=\s\+@\)*" - \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue + \ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonClass,pythonFunction,pythonDoctestValue \ transparent +syn match pythonClass "\h\w*" display contained syn match pythonFunction "\h\w*" display contained syn match pythonComment "#.*$" contains=pythonTodo,@Spell @@ -279,7 +281,7 @@ if !exists("python_no_builtin_highlight") syn keyword pythonBuiltin tuple type vars zip __import__ " avoid highlighting attributes as builtins syn match pythonAttribute /\.\h\w*/hs=s+1 - \ contains=ALLBUT,pythonBuiltin,pythonFunction,pythonAsync + \ contains=ALLBUT,pythonBuiltin,pythonClass,pythonFunction,pythonAsync \ transparent endif @@ -336,7 +338,7 @@ 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,pythonFunction,@Spell + \ contained contains=ALLBUT,pythonDoctest,pythonClass,pythonFunction,@Spell syn region pythonDoctestValue \ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$" \ contained @@ -360,6 +362,7 @@ hi def link pythonInclude Include hi def link pythonAsync Statement hi def link pythonDecorator Define hi def link pythonDecoratorName Function +hi def link pythonClass Structure hi def link pythonFunction Function hi def link pythonComment Comment hi def link pythonTodo Todo From 39af96c8efddd8afe04bce8e48aa446126002e0c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 11 Aug 2025 07:00:58 +0800 Subject: [PATCH 3/3] vim-patch:a94a055: runtime(python): Highlight f-string replacement fields in Python Highlight f-string replacement fields, including - Comments - Debugging flags - Conversion fields - Format specifications - Delimiters Syntax inside fields will be addressed in a separate commit. related: vim/vim#10734 related: vim/vim#14033 closes: vim/vim#17784 https://github.com/vim/vim/commit/a94a0555d911da0d3bcd7e91d76c8e8ef03d9b0e Co-authored-by: Rob B --- runtime/syntax/python.vim | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index c13efc07e2..4f5bac05b9 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic -" Last Change: 2025 Jul 26 +" Last Change: 2025 Aug 10 " Credits: Neil Schemenauer " Dmitry Vasiliev " Rob B @@ -165,25 +165,25 @@ syn region pythonFString \ start=+\cF\z(['"]\)+ \ end="\z1" \ skip="\\\\\|\\\z1" - \ contains=pythonEscape,pythonUnicodeEscape,@Spell + \ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,@Spell syn region pythonFString \ matchgroup=pythonTripleQuotes \ start=+\cF\z('''\|"""\)+ \ end="\z1" \ keepend - \ contains=pythonEscape,pythonUnicodeEscape,pythonSpaceError,pythonDoctest,@Spell + \ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,pythonSpaceError,pythonDoctest,@Spell syn region pythonRawFString \ matchgroup=pythonQuotes \ start=+\c\%(FR\|RF\)\z(['"]\)+ \ end="\z1" \ skip="\\\\\|\\\z1" - \ contains=@Spell + \ contains=pythonFStringField,pythonFStringSkip,@Spell syn region pythonRawFString \ matchgroup=pythonTripleQuotes \ start=+\c\%(FR\|RF\)\z('''\|"""\)+ \ end="\z1" \ keepend - \ contains=pythonSpaceError,pythonDoctest,@Spell + \ contains=pythonFStringField,pythonFStringSkip,pythonSpaceError,pythonDoctest,@Spell " Bytes syn region pythonBytes @@ -209,6 +209,24 @@ syn region pythonRawBytes \ end="\z1" \ keepend +" F-string replacement fields +" +" - Matched parentheses, brackets and braces are ignored +" - A bare # is ignored to end of line +" - A bare = (surrounded by optional whitespace) enables debugging +" - A bare ! prefixes a conversion field +" - A bare : begins a format specification +" - Matched braces inside a format specification are ignored +" +syn region pythonFStringField + \ matchgroup=pythonFStringDelimiter + \ start=/{/ + \ skip=/([^)]*)\|\[[^]]*]\|{[^}]*}\|#.*$/ + \ end=/\%(\s*=\s*\)\=\%(!\a\)\=\%(:\%({[^}]*}\|[^}]*\)\+\)\=}/ + \ contained +" Doubled braces and Unicode escapes are not replacement fields +syn match pythonFStringSkip /{{\|\\N{/ transparent contained contains=NONE + syn match pythonEscape +\\[abfnrtv'"\\]+ contained syn match pythonEscape "\\\o\{1,3}" contained syn match pythonEscape "\\x\x\{2}" contained @@ -376,6 +394,7 @@ hi def link pythonQuotes String hi def link pythonTripleQuotes pythonQuotes hi def link pythonEscape Special hi def link pythonUnicodeEscape pythonEscape +hi def link pythonFStringDelimiter Special if !exists("python_no_number_highlight") hi def link pythonNumber Number endif