diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim new file mode 100644 index 0000000..e0fb08b --- /dev/null +++ b/after/syntax/cpp.vim @@ -0,0 +1,30 @@ +" File: cpp.vim +" Language: C++ +" Description: Additional C++ syntax file. +" Author: Kenneth Benzie (Benie) k.benzie83@gmail.com +" Last Modified: September 02, 2016 + +" Match delimiter expressions: , (expr) {expr} ex::pr +" ^ ^ ^ ^ ^ ^ ^^ +syn match cppDelimiter '\([()\[\]{}<>]\|::\)' +" Match keyword logic operators +syn keyword cppOperator and and_eq bitand bitor compl +syn keyword cppOperator not not_eq or or_eq xor xor_eq +" Match single character operators, ordering within the [] is important +syn match cppOperator '[\*=\.\^\~+-,;&|!%]' +" Match single character operators if they are surrounded by white space: / < > +" ^ ^ ^ +syn match cppOperator '\(\s\zs\/\s\ze\|\s\zs<\s\ze\|\s\zs>\s\ze\)' +" Match multi character operators +syn match cppOperator '\(+=\|-=\|\*=\|/=\|%=\|\ˆ=\|&=\||=\|<<\|>>\|>>=\)' +syn match cppOperator '\(<<=\|==\|!=\|<=\|>=\|&&\|||\|++\|--\|->\*\|->\)' +" Match function expressions: foo() +" ^^^ +syn match cppFunction '\w[A-Za-z0-9_]*\ze\s*(' +" Match nested namespace expressions: expr:: +" ^^^^ +syn match cppStorageClass '\w[A-Za-z0-9_]*\ze::' + +" Define additional highlight groups +hi default link cppDelimiter Delimiter +hi default link cppFunction Function