From 19446ec9cb2b0e9a16330416d789f3007d502f3d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 22 Jun 2026 09:09:13 +0800 Subject: [PATCH] vim-patch:77099ed: runtime(cpp): add C++26 lexical constructs to syntax highlighting Add a guarded "C++ 26 extensions" block (cpp_no_cpp26) covering new lexical surface introduced since C++23: - [[ ... ]] attributes as a region, so P3394 annotations carrying a value expression (eg [[=foo{1}]]) no longer trip cErrInBracket on their braces/parens. A \w\@1 --- runtime/doc/syntax.txt | 1 + runtime/syntax/cpp.vim | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 4e4a7b4658..33bae966a7 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -777,6 +777,7 @@ cpp_no_cpp14 don't highlight C++14 standard items cpp_no_cpp17 don't highlight C++17 standard items cpp_no_cpp20 don't highlight C++20 standard items cpp_no_cpp23 don't highlight C++23 standard items +cpp_no_cpp26 don't highlight C++26 standard items CSH *ft-csh-syntax* diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index 1c725a4bfd..121eab2c6f 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -110,6 +110,15 @@ if !exists("cpp_no_cpp23") syn keyword cppType float16_t float32_t float64_t float128_t bfloat16_t endif +" C++ 26 extensions +if !exists("cpp_no_cpp26") + " attribute [[ ... ]] with optional value expr, eg [[=foo{1}]] + syn region cppAttribute matchgroup=cppAttributeBracket start="\w\@1]?" @@ -134,6 +143,9 @@ hi def link cppString String hi def link cppNumber Number hi def link cppFloat Number hi def link cppModule Include +hi def link cppAttributeBracket Special +hi def link cppReflect Operator +hi def link cppSpliceBracket Special let b:current_syntax = "cpp"