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