1" Vim syntax file 2" Language: C++ 3" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) 4" Previous Maintainer: Ken Shan <[email protected]> 5" Last Change: 2021 Jan 12 6 7" quit when a syntax file was already loaded 8if exists("b:current_syntax") 9 finish 10endif 11 12" inform C syntax that the file was included from cpp.vim 13let b:filetype_in_cpp_family = 1 14 15" Read the C syntax to start with 16runtime! syntax/c.vim 17unlet b:current_syntax 18 19" C++ extensions 20syn keyword cppStatement new delete this friend using 21syn keyword cppAccess public protected private 22syn keyword cppModifier inline virtual explicit export 23syn keyword cppType bool wchar_t 24syn keyword cppExceptions throw try catch 25syn keyword cppOperator operator typeid 26syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq 27syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 28syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" 29syn keyword cppStorageClass mutable 30syn keyword cppStructure class typename template namespace 31syn keyword cppBoolean true false 32syn keyword cppConstant __cplusplus 33 34" C++ 11 extensions 35if !exists("cpp_no_cpp11") 36 syn keyword cppModifier override final 37 syn keyword cppType nullptr_t auto 38 syn keyword cppExceptions noexcept 39 syn keyword cppStorageClass constexpr decltype thread_local 40 syn keyword cppConstant nullptr 41 syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT 42 syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE 43 syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE 44 syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE 45 syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE 46 syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE 47 syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell 48 syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*<"me=e-1 49 syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*$" 50endif 51 52" C++ 14 extensions 53if !exists("cpp_no_cpp14") 54 syn case ignore 55 syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>" 56 syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" contains=cFloat 57 syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>" 58 syn case match 59endif 60 61" C++ 20 extensions 62if !exists("cpp_no_cpp20") 63 syn keyword cppStatement co_await co_return co_yield requires 64 syn keyword cppStorageClass consteval constinit 65 syn keyword cppStructure concept 66 syn keyword cppType char8_t 67 syn keyword cppModule import module export 68endif 69 70" C++ 17 extensions 71if !exists("cpp_no_cpp17") 72 syn match cppCast "\<reinterpret_pointer_cast\s*<"me=e-1 73 syn match cppCast "\<reinterpret_pointer_cast\s*$" 74endif 75 76" The minimum and maximum operators in GNU C++ 77syn match cppMinMax "[<>]?" 78 79" Default highlighting 80hi def link cppAccess cppStatement 81hi def link cppCast cppStatement 82hi def link cppExceptions Exception 83hi def link cppOperator Operator 84hi def link cppStatement Statement 85hi def link cppModifier Type 86hi def link cppType Type 87hi def link cppStorageClass StorageClass 88hi def link cppStructure Structure 89hi def link cppBoolean Boolean 90hi def link cppConstant Constant 91hi def link cppRawStringDelimiter Delimiter 92hi def link cppRawString String 93hi def link cppNumber Number 94hi def link cppModule Include 95 96let b:current_syntax = "cpp" 97 98" vim: ts=8 99