diff options
Diffstat (limited to 'runtime/syntax/cpp.vim')
-rw-r--r-- | runtime/syntax/cpp.vim | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index 9cb0860e84..ed38913f29 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -2,13 +2,16 @@ " Language: C++ " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> -" Last Change: 2017 Jun 05 +" Last Change: 2021 Jan 12 " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif +" inform C syntax that the file was included from cpp.vim +let b:filetype_in_cpp_family = 1 + " Read the C syntax to start with runtime! syntax/c.vim unlet b:current_syntax @@ -42,6 +45,8 @@ if !exists("cpp_no_cpp11") syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell + syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*<"me=e-1 + syn match cppCast "\<\(const\|static\|dynamic\)_pointer_cast\s*$" endif " C++ 14 extensions @@ -53,6 +58,21 @@ if !exists("cpp_no_cpp14") syn case match endif +" C++ 20 extensions +if !exists("cpp_no_cpp20") + syn keyword cppStatement co_await co_return co_yield requires + syn keyword cppStorageClass consteval constinit + syn keyword cppStructure concept + syn keyword cppType char8_t + syn keyword cppModule import module export +endif + +" C++ 17 extensions +if !exists("cpp_no_cpp17") + syn match cppCast "\<reinterpret_pointer_cast\s*<"me=e-1 + syn match cppCast "\<reinterpret_pointer_cast\s*$" +endif + " The minimum and maximum operators in GNU C++ syn match cppMinMax "[<>]?" @@ -71,6 +91,7 @@ hi def link cppConstant Constant hi def link cppRawStringDelimiter Delimiter hi def link cppRawString String hi def link cppNumber Number +hi def link cppModule Include let b:current_syntax = "cpp" |