Enable folding {} in C/C++ & delimiter highlights

This commit is contained in:
Kenneth Benzie 2016-09-08 09:40:39 +01:00
parent 0bc30ad5c9
commit 657a029acc

View File

@ -5,7 +5,7 @@
" Match delimiter expressions: (expr) {expr} : ; " Match delimiter expressions: (expr) {expr} : ;
" ^ ^ ^ ^ ^ ^ " ^ ^ ^ ^ ^ ^
syn match cDelimiter '[()\[\]{}:;]' syn match cDelimiter '[()\[\]:;]'
" Match single character operators, ordering within the [] is important " Match single character operators, ordering within the [] is important
syn match cOperator '[\*=\.\^\~+\-,&|!%?]' syn match cOperator '[\*=\.\^\~+\-,&|!%?]'
" Match single character operators if they are surrounded by white space: / < > " Match single character operators if they are surrounded by white space: / < >
@ -31,6 +31,12 @@ if g:c_enable_doxygen_highlights
hi default link cDoxygen SpecialComment hi default link cDoxygen SpecialComment
endif endif
" Match curly braces with cDelimiter highlight group
syn match cCurlyError "}"
syn region cBlock matchgroup=cDelimiter start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell fold
syn region cBlock matchgroup=cDelimiter start="{" end="}" transparent fold
" Define additional highlight groups " Define additional highlight groups
hi default link cDelimiter Delimiter hi default link cDelimiter Delimiter
hi default link cFunction Function hi default link cFunction Function