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: 2016 Jul 07 6 7" For version 5.x: Clear all syntax items 8" For version 6.x: Quit when a syntax file was already loaded 9if version < 600 10 syntax clear 11elseif exists("b:current_syntax") 12 finish 13endif 14 15" Read the C syntax to start with 16if version < 600 17 so <sfile>:p:h/c.vim 18else 19 runtime! syntax/c.vim 20 unlet b:current_syntax 21endif 22 23" C++ extensions 24syn keyword cppStatement new delete this friend using 25syn keyword cppAccess public protected private 26syn keyword cppModifier inline virtual explicit export 27syn keyword cppType bool wchar_t 28syn keyword cppExceptions throw try catch 29syn keyword cppOperator operator typeid 30syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq 31syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 32syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" 33syn keyword cppStorageClass mutable 34syn keyword cppStructure class typename template namespace 35syn keyword cppBoolean true false 36syn keyword cppConstant __cplusplus 37 38" C++ 11 extensions 39if !exists("cpp_no_cpp11") 40 syn keyword cppModifier override final 41 syn keyword cppType nullptr_t 42 syn keyword cppExceptions noexcept 43 syn keyword cppStorageClass constexpr decltype thread_local 44 syn keyword cppConstant nullptr 45 syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT 46 syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE 47 syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE 48 syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE 49 syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE 50 syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE 51 syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell 52endif 53 54" C++ 14 extensions 55if !exists("cpp_no_cpp14") 56 syn match cppNumber display "\<0b[01]\+\(u\=l\{0,2}\|ll\=u\)\>" 57endif 58 59" The minimum and maximum operators in GNU C++ 60syn match cppMinMax "[<>]?" 61 62" Default highlighting 63if version >= 508 || !exists("did_cpp_syntax_inits") 64 if version < 508 65 let did_cpp_syntax_inits = 1 66 command -nargs=+ HiLink hi link <args> 67 else 68 command -nargs=+ HiLink hi def link <args> 69 endif 70 HiLink cppAccess cppStatement 71 HiLink cppCast cppStatement 72 HiLink cppExceptions Exception 73 HiLink cppOperator Operator 74 HiLink cppStatement Statement 75 HiLink cppModifier Type 76 HiLink cppType Type 77 HiLink cppStorageClass StorageClass 78 HiLink cppStructure Structure 79 HiLink cppBoolean Boolean 80 HiLink cppConstant Constant 81 HiLink cppRawStringDelimiter Delimiter 82 HiLink cppRawString String 83 HiLink cppNumber Number 84 delcommand HiLink 85endif 86 87let b:current_syntax = "cpp" 88 89" vim: ts=8 90