44" Previous Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
5566" Last Change: 2024 May 04
7- " 2024 May 04 by Vim Project (fix digit separator in octals and floats)
8- " 2026 Jan 06 by Vim Project (announce adoption)
7+ " 2024 May 04 by Vim Project fix digit separator in octals and floats
8+ " 2026 Jan 06 by Vim Project orphaning announcement
9+ " 2026 Jan 08 by Vim Project highlight capital letter prefixes for numbers
910
1011" quit when a syntax file was already loaded
1112if exists (" b:current_syntax" )
@@ -59,20 +60,20 @@ if !exists("cpp_no_cpp14")
5960 syn match cppNumber display contained " \< 0\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
6061 syn match cppNumber display contained " \< [1-9]\( '\=\d\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
6162 syn match cppNumber display contained " \< 0\( '\=\o\+\)\+\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
62- syn match cppNumber display contained " \< 0b [01]\( '\= [01]\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
63- syn match cppNumber display contained " \< 0x \x\( '\=\x\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
64- syn match cppFloat display contained " \<\d\( '\=\d\+\) *\.\(\d\( '\=\d\+\) *\)\=\( e [-+]\=\d\+\)\=\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
65- syn match cppFloat display contained " \.\d\( '\=\d\+\) *\( e [-+]\=\d\+\)\=\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
66- syn match cppFloat display contained " \<\d\+ e [-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
63+ syn match cppNumber display contained " \< 0[Bb] [01]\( '\= [01]\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
64+ syn match cppNumber display contained " \< 0[Xx] \x\( '\=\x\+\) *\( [Uu]\=\( [Ll]\| LL\| ll\)\|\( [Ll]\| LL\| ll\)\= [Uu]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
65+ syn match cppFloat display contained " \<\d\( '\=\d\+\) *\.\(\d\( '\=\d\+\) *\)\=\( [Ee] [-+]\=\d\+\)\=\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
66+ syn match cppFloat display contained " \.\d\( '\=\d\+\) *\( [Ee] [-+]\=\d\+\)\=\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
67+ syn match cppFloat display contained " \<\d\+ [Ee] [-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
6768 syn region cppString start =+ \( L\| u\| u8\| U\)\= "+ skip =+ \\\\\|\\ "\|\\ $+ excludenl end =+ "\( sv\| s\| _\i *\)\= + end =' $' contains =cSpecial,cFormat,@Spell
6869endif
6970
7071" C++ 17 extensions
7172if ! exists (" cpp_no_cpp17" )
7273 syn match cppCast " \< reinterpret_pointer_cast\s *<" me =e - 1
7374 syn match cppCast " \< reinterpret_pointer_cast\s *$"
74- syn match cppFloat display contained " \< 0x \x *\.\x\+ p[-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
75- syn match cppFloat display contained " \< 0x \x\+\.\= p[-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
75+ syn match cppFloat display contained " \< 0[Xx] \x *\.\x\+ p[-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
76+ syn match cppFloat display contained " \< 0[Xx] \x\+\.\= p[-+]\=\d\+\( [FfLl]\| i[fl]\=\| h\| min\| s\| ms\| us\| ns\| _\i *\)\=\> "
7677
7778 " TODO: push this up to c.vim if/when supported in C23
7879 syn match cppCharacter " u8'[^\\ ]'"
@@ -94,8 +95,8 @@ if !exists("cpp_no_cpp20")
9495 syn match cppNumber display contained " \< 0\( y\| d\)\> "
9596 syn match cppNumber display contained " \< [1-9]\( '\=\d\+\) *\( y\| d\)\> "
9697 syn match cppNumber display contained " \< 0\o\+\( y\| d\)\> "
97- syn match cppNumber display contained " \< 0b [01]\( '\= [01]\+\) *\( y\| d\)\> "
98- syn match cppNumber display contained " \< 0x \x\( '\=\x\+\) *\( y\| d\)\> "
98+ syn match cppNumber display contained " \< 0[Bb] [01]\( '\= [01]\+\) *\( y\| d\)\> "
99+ syn match cppNumber display contained " \< 0[Xx] \x\( '\=\x\+\) *\( y\| d\)\> "
99100 syn keyword cppStatement co_await co_return co_yield requires
100101 syn keyword cppStorageClass consteval constinit
101102 syn keyword cppStructure concept
0 commit comments