From 5dd1a7e83966c92d220073185f1738dfe441f59e Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 2 May 2016 10:42:37 +0200 Subject: Update --- after/syntax/cpp.vim | 86 ++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 39 deletions(-) (limited to 'after/syntax/cpp.vim') diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim index f6c866a6..c0bc3ec7 100644 --- a/after/syntax/cpp.vim +++ b/after/syntax/cpp.vim @@ -36,22 +36,56 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1 " Functions syn match cCustomParen "(" contains=cParen contains=cCppParen -syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen +syn match cCustomFunc "\w\+\s*(\@=" hi def link cCustomFunc Function -" Template functions -if exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_template_highlight - syn region cCustomAngleBrackets matchgroup=AngleBracketContents start="\v%(" contains=cCustomAngleBrackets - syn match cCustomTemplateFunc "\w\+\s*<.*>(\@=" contains=cCustomBrack,cCustomAngleBrackets - hi def link cCustomTemplateFunc Function -endif - " Class and namespace scope if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight syn match cCustomScope "::" - syn match cCustomClass "\w\+\s*::" contains=cCustomScope - hi def link cCustomClass Function " disabled for now + syn match cCustomClass "\w\+\s*::" + \contains=cCustomScope + " hi def link cCustomClass Function " disabled for now + syn match cCustomClass "\<\u\w*\s*\>" +endif + +" Template functions +if exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_template_highlight + + syn match cCustomAngleBracketStart "<\_[^;()]\{-}>" contained + \contains=cCustomAngleBracketStart, cCustomAngleBracketEnd + hi def link cCustomAngleBracketStart cCustomAngleBracketContent + + syn match cCustomAngleBracketEnd ">\_[^<>;()]\{-}>" contained + \contains=cCustomAngleBracketEnd + hi def link cCustomAngleBracketEnd cCustomAngleBracketContent + + syn match cCustomTemplateFunc "\<\l\w*\s*<\_[^;()]\{-}>(\@="hs=s,he=e-1 + \contains=cCustomAngleBracketStart + hi def link cCustomTemplateFunc cCustomFunc + + syn match cCustomTemplateClass "\<\w\+\s*<\_[^;()]\{-}>" + \contains=cCustomAngleBracketStart,cCustomTemplateFunc + hi def link cCustomTemplateClass cCustomClass + + + " Remove 'template' from cppStructure and use a custom match + syn clear cppStructure + syn keyword cppStructure class typename namespace + + syn match cCustomTemplate "\" + hi def link cCustomTemplate cppStructure + syn match cTemplateDeclare "\" + \contains=cppStructure,cCustomTemplate,cCustomAngleBracketStart + + " Remove 'operator' from cppStructure and use a custom match + syn clear cppOperator + syn keyword cppOperator typeid + syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq + + syn match cCustomOperator "\" + hi def link cCustomOperator cppStructure + syn match cTemplateOperatorDeclare "\[<>]=\?" + \contains=cppOperator,cCustomOperator,cCustomAngleBracketStart endif " Alternative syntax that is used in: @@ -65,7 +99,7 @@ syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconst " ----------------------------------------------------------------------------- " Standard library types and functions. " -" Mainly based on the excellent STL Syntax vim script by +" Mainly based on the excellent STL Syntax vim script by " Mizuchi " http://www.vim.org/scripts/script.php?script_id=4293 " which in turn is based on the scripts @@ -136,7 +170,6 @@ syntax keyword cppSTLfunctional binary_negate syntax keyword cppSTLfunctional bit_and syntax keyword cppSTLfunctional bit_not syntax keyword cppSTLfunctional bit_or -syntax keyword cppSTLfunctional bit_xor syntax keyword cppSTLfunctional divides syntax keyword cppSTLfunctional equal_to syntax keyword cppSTLfunctional greater @@ -1324,31 +1357,6 @@ if !exists("cpp_no_cpp14") "dynarray syntax keyword cppSTLtype dynarray - "helper type traits types - syntax keyword cppSTLtype remove_cv_t - syntax keyword cppSTLtype remove_const_t - syntax keyword cppSTLtype remove_volatile_t - syntax keyword cppSTLtype add_cv_t - syntax keyword cppSTLtype add_const_t - syntax keyword cppSTLtype add_volatile_t - syntax keyword cppSTLtype remove_reference_t - syntax keyword cppSTLtype add_lvalue_reference_t - syntax keyword cppSTLtype add_rvalue_reference_t - syntax keyword cppSTLtype remove_pointer_t - syntax keyword cppSTLtype add_pointer_t - syntax keyword cppSTLtype remove_extent_t - syntax keyword cppSTLtype remove_all_extents_t - syntax keyword cppSTLtype make_signed_t - syntax keyword cppSTLtype make_unsigned_t - syntax keyword cppSTLtype aligned_storage_t - syntax keyword cppSTLtype aligned_union_t - syntax keyword cppSTLtype decay_t - syntax keyword cppSTLtype enable_if_t - syntax keyword cppSTLtype conditional_t - syntax keyword cppSTLtype common_type_t - syntax keyword cppSTLtype underlying_type_t - syntax keyword cppSTLtype result_of_t - "thread syntax keyword cppSTLtype shared_mutex syntax keyword cppSTLtype shared_lock @@ -1387,7 +1395,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits") HiLink cppSTLenum Typedef HiLink cppSTLios Function HiLink cppSTLcast Statement " be consistent with official syntax - HiLink cppRawString String + HiLink cppRawString String HiLink cppRawDelimiter Delimiter delcommand HiLink endif -- cgit v1.2.3