blob: feb89ee614ef497582f71c6a7feeb9f687df14a6 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: C++
3" Maintainer: Ken Shan <ccshan@post.harvard.edu>
4" Last Change: 2002 Jul 15
5
6" For version 5.x: Clear all syntax items
7" For version 6.x: Quit when a syntax file was already loaded
8if version < 600
9 syntax clear
10elseif exists("b:current_syntax")
11 finish
12endif
13
14" Read the C syntax to start with
15if version < 600
16 so <sfile>:p:h/c.vim
17else
18 runtime! syntax/c.vim
19 unlet b:current_syntax
20endif
21
22" C++ extentions
23syn keyword cppStatement new delete this friend using
24syn keyword cppAccess public protected private
25syn keyword cppType inline virtual explicit export bool wchar_t
26syn keyword cppExceptions throw try catch
27syn keyword cppOperator operator typeid
28syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
29syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1
30syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$"
31syn keyword cppStorageClass mutable
32syn keyword cppStructure class typename template namespace
33syn keyword cppNumber NPOS
34syn keyword cppBoolean true false
35
36" The minimum and maximum operators in GNU C++
37syn match cppMinMax "[<>]?"
38
39" Default highlighting
40if version >= 508 || !exists("did_cpp_syntax_inits")
41 if version < 508
42 let did_cpp_syntax_inits = 1
43 command -nargs=+ HiLink hi link <args>
44 else
45 command -nargs=+ HiLink hi def link <args>
46 endif
47 HiLink cppAccess cppStatement
48 HiLink cppCast cppStatement
49 HiLink cppExceptions Exception
50 HiLink cppOperator Operator
51 HiLink cppStatement Statement
52 HiLink cppType Type
53 HiLink cppStorageClass StorageClass
54 HiLink cppStructure Structure
55 HiLink cppNumber Number
56 HiLink cppBoolean Boolean
57 delcommand HiLink
58endif
59
60let b:current_syntax = "cpp"
61
62" vim: ts=8