A whole bunch of C++ highlight support.

This commit is contained in:
2022-04-19 14:30:06 -04:00
parent 3a20ae1e5d
commit a9b6fe10da
2 changed files with 48 additions and 17 deletions

View File

@ -8,6 +8,9 @@ syn keyword cppType noexcept decltype
" I dislike the exception highlighting for these control statements. " I dislike the exception highlighting for these control statements.
syn keyword cppStatement try throw catch syn keyword cppStatement try throw catch
" Assert is kinda like a statement -- as a macro it's a kinda dangerous name, so call it out.
syn keyword cppStatement assert
"syn keyword cppStatement static_assert "syn keyword cppStatement static_assert
syn keyword cxxConstants nullptr syn keyword cxxConstants nullptr
@ -35,6 +38,10 @@ syn cluster cxxIgnoreCGroupingErrors add=@cxxLibraryBits
"syn region cxxStlLibrary start="\<std\(::\)\@<=" end="\( \|<\|(\|;\)\@=" "syn region cxxStlLibrary start="\<std\(::\)\@<=" end="\( \|<\|(\|;\)\@="
syn region cxxStlLibrary matchgroup=cxxLibPrefix start="\<\(std\)\z(::\)\@=" matchgroup=NONE skip="\z1" end="\>" transparent syn region cxxStlLibrary matchgroup=cxxLibPrefix start="\<\(std\)\z(::\)\@=" matchgroup=NONE skip="\z1" end="\>" transparent
syn region cxxBoostLibrary matchgroup=cxxLibPrefix start="\<\(boost\)\z(::\)\@=" matchgroup=NONE skip="\z1" end="\>" transparent syn region cxxBoostLibrary matchgroup=cxxLibPrefix start="\<\(boost\)\z(::\)\@=" matchgroup=NONE skip="\z1" end="\>" transparent
"syn region cxxStlLibraryLiterals matchgroup=cxxLibLiterals start="\<\(literals\)\z(::\)\@=" matchgroup=NONE skip="\z1" end="\>" transparent contained containedin=cxxStlLibrary
"syn keyword cxxLibLiterals string_literals string_view_literals contained containedin=cxxStlLibraryLiterals
syn keyword cxxLibLiterals literals
syn match cxxLibLiterals "\<[a-z][a-z_0-9]*_literals\>"
"syn match "::" containedin=@cxxLibrary contained "syn match "::" containedin=@cxxLibrary contained
"end="::\(.*\)\@>\>" "end="::\(.*\)\@>\>"
@ -49,7 +56,7 @@ syn keyword cxxStlKeywords contained containedin=cxxAttribute noreturn carries_d
" Threading " Threading
syn keyword cxxStlKeywords contained containedin=cxxStlLibrary,cxxBoostLibrary mutex condition_variable thread lock_guard scoped_lock unique_lock syn keyword cxxStlKeywords contained containedin=cxxStlLibrary,cxxBoostLibrary mutex condition_variable condition_variable_any thread lock_guard scoped_lock unique_lock
" Strings " Strings
syn keyword cxxStlKeywords containedin=cxxStlLibrary string contained syn keyword cxxStlKeywords containedin=cxxStlLibrary string contained
@ -61,7 +68,11 @@ syn keyword cxxStlKeywords containedin=cxxStlLibrary,cxxBoostLibrary function co
syn keyword cxxStlTypes containedin=cxxStlLibrary exception_ptr contained syn keyword cxxStlTypes containedin=cxxStlLibrary exception_ptr contained
syn keyword cxxStlTypes containedin=cxxStlLibrary iostream istream ostream fstream ifstream ofstream contained syn keyword cxxStlTypes containedin=cxxStlLibrary iostream istream ostream fstream ifstream ofstream contained
syn keyword cxxStlTypes containedin=cxxStlLibrary stringstream istringstream ostringstream contained syn keyword cxxStlTypes containedin=cxxStlLibrary stringstream istringstream ostringstream contained
syn keyword cxxStlTypes containedin=cxxStlLibrary iostream basic_string vector deque list pair queue priority_queue stack map multimap set multiset contained syn keyword cxxStlTypes containedin=cxxStlLibrary iostream basic_string vector deque list pair queue priority_queue stack contained
syn keyword cxxStlTypes containedin=cxxStlLibrary map multimap set multiset contained
syn keyword cxxStlTypes containedin=cxxStlLibrary istream_iterator ostream_iterator contained
syn keyword cxxStlTypes containedin=cxxStlLibrary iterator contained
syn keyword cxxStlConstant containedin=cxxStlLibrary input_iterator_tag output_iterator_tag forward_iterator_tag bidirectional_iterator_tag random_access_iterator_tag contained
syn keyword cxxStlTypes containedin=cxxStlLibrary,cxxBoostLibrary array contained syn keyword cxxStlTypes containedin=cxxStlLibrary,cxxBoostLibrary array contained
syn keyword cxxStlTypes containedin=cxxStlLibrary,cxxBoostLibrary unordered_map unordered_multimap contained syn keyword cxxStlTypes containedin=cxxStlLibrary,cxxBoostLibrary unordered_map unordered_multimap contained
@ -79,13 +90,15 @@ syn keyword cxxStlFunctions containedin=cxxStlLibrary,cxxBoostLibrary make_share
syn keyword cxxStlKeywords containedin=cxxBoostLibrary scoped_ptr contained syn keyword cxxStlKeywords containedin=cxxBoostLibrary scoped_ptr contained
syn keyword cxxStlKeywords containedin=cxxStlLibrary,cxxBoostLibrary shared_ptr weak_ptr optional contained syn keyword cxxStlKeywords containedin=cxxStlLibrary,cxxBoostLibrary shared_ptr weak_ptr optional contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary make_unique contained syn keyword cxxStlFunctions containedin=cxxStlLibrary make_unique contained
syn keyword cxxStlKeywords containedin=cxxStlLibrary unique_ptr nullptr_t contained syn keyword cxxStlKeywords containedin=cxxStlLibrary unique_ptr nullptr_t max_align_t contained
" Algorithms " Algorithms
syn keyword cxxStlFunctions containedin=cxxStlLibrary make_pair tie addressof contained syn keyword cxxStlFunctions containedin=cxxStlLibrary make_pair tie addressof contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary copy copy_n copy_if copy_backward replace_copy_if replace_copy contained syn keyword cxxStlFunctions containedin=cxxStlLibrary copy copy_n copy_if copy_backward replace_copy_if replace_copy contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary find find_if find_first_of find_end contained syn keyword cxxStlFunctions containedin=cxxStlLibrary find find_if find_first_of find_end contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary count count_if search search_n contained syn keyword cxxStlFunctions containedin=cxxStlLibrary count count_if search search_n contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary lower_bound upper_bound contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary distance contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary transform mismatch equal accumulate move forward contained syn keyword cxxStlFunctions containedin=cxxStlLibrary transform mismatch equal accumulate move forward contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary generate generate_n fill fill_n contained syn keyword cxxStlFunctions containedin=cxxStlLibrary generate generate_n fill fill_n contained
syn keyword cxxStlFunctions containedin=cxxStlLibrary unique reverse rotate contained syn keyword cxxStlFunctions containedin=cxxStlLibrary unique reverse rotate contained
@ -106,9 +119,13 @@ syn keyword cxxStlKeywords contained containedin=cxxStlLibrary type_info type_in
" Metafunctions/Traits " Metafunctions/Traits
syn keyword cxxLibStatement contained containedin=cxxStlLibrary decay_t syn keyword cxxLibStatement contained containedin=cxxStlLibrary decay_t
syn keyword cxxLibStatement contained containedin=cxxStlLibrary add_pointer_t
syn keyword cxxLibStatement contained containedin=cxxStlLibrary add_const_t
syn keyword cxxLibStatement contained containedin=cxxStlLibrary remove_reference_t
syn keyword cxxLibStatement contained containedin=cxxStlLibrary declval syn keyword cxxLibStatement contained containedin=cxxStlLibrary declval
syn keyword cxxStlTypes contained containedin=cxxStlLibrary type_identity type_identity_t syn keyword cxxStlTypes contained containedin=cxxStlLibrary type_identity type_identity_t
syn keyword cxxStlTraits contained containedin=cxxStlLibrary is_convertible is_base_of syn keyword cxxStlTraits contained containedin=cxxStlLibrary is_convertible is_base_of is_const
syn keyword cxxStlTraits contained containedin=cxxStlLibrary is_standard_layout
syn keyword cxxStlTraits contained containedin=cxxStlLibrary is_constructible is_default_constructible is_same syn keyword cxxStlTraits contained containedin=cxxStlLibrary is_constructible is_default_constructible is_same
syn keyword cxxStlTraits contained containedin=cxxStlLibrary enable_if enable_if_t syn keyword cxxStlTraits contained containedin=cxxStlLibrary enable_if enable_if_t
syn keyword cxxStlTraits contained containedin=cxxBoostLibrary enable_if enable_if_t syn keyword cxxStlTraits contained containedin=cxxBoostLibrary enable_if enable_if_t
@ -119,11 +136,12 @@ syn keyword cxxStlConstant contained containedin=cxxStlLibrary bool_constant is_
syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary bool_constant true_type false_type is_base_of_v syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary bool_constant true_type false_type is_base_of_v
syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary is_rvalue_reference_v syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary is_rvalue_reference_v
syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary is_aggregate_v syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary is_aggregate_v
syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary is_integral_v syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary is_standard_layout_v
syn keyword cxxStlConstant contained containedin=cxxStlLibrary,cxxBoostLibrary is_integral_v is_const_v
syn keyword cxxLibStatement contained containedin=cxxStlLibrary void_t syn keyword cxxLibStatement contained containedin=cxxStlLibrary void_t
" Free floating STL functions " Free floating STL functions
syn keyword cxxStlFreeFunctions back_inserter front_inserter inserter begin end syn keyword cxxStlFreeFunctions back_inserter front_inserter inserter begin end cbegin cend rbegin rend
" Exceptions " Exceptions
@ -142,6 +160,11 @@ syn keyword cxxStlExceptionNames containedin=cxxStlLibrary range_error contained
syn keyword cxxStlExceptionNames containedin=cxxStlLibrary overflow_error contained syn keyword cxxStlExceptionNames containedin=cxxStlLibrary overflow_error contained
syn keyword cxxStlExceptionNames containedin=cxxStlLibrary underflow_error contained syn keyword cxxStlExceptionNames containedin=cxxStlLibrary underflow_error contained
" Not really an exception, but it kinda is related
syn keyword cxxStlNothrow containedin=cxxStlLibrary nothrow_t contained
syn keyword cxxStlNothrowObject containedin=cxxStlLibrary nothrow contained
" Some common boost-only bits I use " Some common boost-only bits I use
syn keyword cxxStlKeywords contained containedin=cxxBoostLibrary syn keyword cxxStlKeywords contained containedin=cxxBoostLibrary
syn keyword cxxLibStatement contained containedin=cxxBoostLibrary lexical_cast noncopyable syn keyword cxxLibStatement contained containedin=cxxBoostLibrary lexical_cast noncopyable
@ -153,6 +176,9 @@ syn keyword cxxStlKeywords template_for
" Highlight dangerous things " Highlight dangerous things
syn match cxxStlDangerousFunction "\(\.\)\@<=release()" syn match cxxStlDangerousFunction "\(\.\)\@<=release()"
syn match cxxTestingCall "\<test\.expect\>"
syn match cxxTestingCall "\<test\.demand\>"
" Define the default highlighting. " Define the default highlighting.
" For version 5.7 and earlier: only when not done already " For version 5.7 and earlier: only when not done already
@ -176,6 +202,8 @@ if version >= 508 || !exists("did_cxx_syntax_inits")
HiLink cxxExceptionNames Exception HiLink cxxExceptionNames Exception
HiLink cxxStlExceptionNames Exception HiLink cxxStlExceptionNames Exception
HiLink cxxStlNothrow Nothrow
HiLink cxxStlNothrowObject NothrowObject
HiLink cxxErrorNames Error HiLink cxxErrorNames Error
HiLink cxxDebug Debug HiLink cxxDebug Debug
HiLink cxxConstants Constant HiLink cxxConstants Constant
@ -188,9 +216,12 @@ if version >= 508 || !exists("did_cxx_syntax_inits")
HiLink cxxStlFreeFunctions cppStatement HiLink cxxStlFreeFunctions cppStatement
HiLink cxxLibStatement cppStatement HiLink cxxLibStatement cppStatement
HiLink cxxAttributeBracing cppStatement HiLink cxxAttributeBracing cppStatement
HiLink cxxTestingCall TestCall
HiLink cxxLibPrefix Caller HiLink cxxLibPrefix Caller
HiLink cxxLibLiterals Literals
HiLink cxxExportNamespace cppModule HiLink cxxExportNamespace cppModule

View File

@ -14,14 +14,6 @@ hi clear normal
"let colors_name = "adam" "let colors_name = "adam"
let g:colors_name="adam" let g:colors_name="adam"
" I stole ron's as a starting point as I think that it's my color scheme
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Ron Aaron <ron@ronware.org>
" Last Change: 2013 May 24
set background=dark set background=dark
hi Normal ctermfg=lightgrey start=<esc>[0m stop=<esc>[0m hi Normal ctermfg=lightgrey start=<esc>[0m stop=<esc>[0m
"hi NonText ctermfg=yellow ctermbg=grey "hi NonText ctermfg=yellow ctermbg=grey
@ -34,7 +26,7 @@ hi preproc ctermfg=blue term=none start=<esc>[94m stop=<esc>[0m
hi type ctermfg=green term=none start=<esc>[92m stop=<esc>[0m hi type ctermfg=green term=none start=<esc>[92m stop=<esc>[0m
"hi type ctermfg=green cterm=bold "hi type ctermfg=green cterm=bold
"hi special ctermfg=yellow "hi special ctermfg=yellow
hi Special ctermfg=Blue guifg=Blue term=none start=<esc>[94m stop=<esc>[0m hi Special ctermfg=Blue guifg=Blue term=none start=<esc>[94m stop=<esc>[0m
hi ErrorMsg ctermfg=White ctermbg=Red term=none start=<esc>[97;101m stop=<esc>[0m hi ErrorMsg ctermfg=White ctermbg=Red term=none start=<esc>[97;101m stop=<esc>[0m
hi WarningMsg ctermfg=Black ctermbg=Green hi WarningMsg ctermfg=Black ctermbg=Green
"hi Error ctermbg=Red "hi Error ctermbg=Red
@ -46,6 +38,8 @@ hi Directory ctermfg=Blue term=none start=<esc>[94m stop=<esc>[0m
hi ModeMsg ctermfg=white cterm=bold term=bold start=<esc>[97m stop=<esc>[0m hi ModeMsg ctermfg=white cterm=bold term=bold start=<esc>[97m stop=<esc>[0m
hi Literals ctermfg=lightmagenta cterm=italic
" Directory thru netrw " Directory thru netrw
hi netrwHelpCmd ctermfg=Green hi netrwHelpCmd ctermfg=Green
@ -53,7 +47,11 @@ hi netrwHelpCmd ctermfg=Green
hi netrwHdr ctermfg=brown hi netrwHdr ctermfg=brown
hi netrwSrc ctermfg=green hi netrwSrc ctermfg=green
hi netrwExe ctermfg=Red cterm=bold hi netrwExe ctermfg=Red cterm=bold
hi netrwSymLink ctermfg=Cyan hi netrwSymLink ctermfg=Cyan
hi TestCall ctermfg=78 cterm=italic
"hi Cursor guibg=#60a060 guifg=#00ff00 "hi Cursor guibg=#60a060 guifg=#00ff00
" ctermfg=#00ff00 " ctermfg=#00ff00
@ -94,6 +92,8 @@ hi Comment ctermfg=darkgrey cterm=none term=NONE term=none start=<esc>[38;5;242m
hi Identifier ctermfg=cyan cterm=none term=none start=<esc>[96m stop=<esc>[0m hi Identifier ctermfg=cyan cterm=none term=none start=<esc>[96m stop=<esc>[0m
hi Object ctermfg=red term=none start=<esc>[91m stop=<esc>[0m hi Object ctermfg=red term=none start=<esc>[91m stop=<esc>[0m
hi Exception ctermfg=brown term=none start=<esc>[38;5;130m stop=<esc>[0m hi Exception ctermfg=brown term=none start=<esc>[38;5;130m stop=<esc>[0m
hi Nothrow ctermfg=215 term=none start=<esc>[38;5;130m stop=<esc>[0m
hi Nothrow ctermfg=58 term=none start=<esc>[38;5;130m stop=<esc>[0m
hi Service ctermfg=green start=<esc>[32m stop=<esc>[0m hi Service ctermfg=green start=<esc>[32m stop=<esc>[0m
hi Error ctermbg=red ctermfg=white cterm=none term=none start=<esc>[101;97m stop=<esc>[0m hi Error ctermbg=red ctermfg=white cterm=none term=none start=<esc>[101;97m stop=<esc>[0m
hi Caller ctermfg=cyan term=NONE start=<esc>[96m stop=<esc>[0m hi Caller ctermfg=cyan term=NONE start=<esc>[96m stop=<esc>[0m