vim/after/syntax/cpp.vim

31 lines
1.3 KiB
VimL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

" 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) {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