From 0911af4c4c2ba8b54fe1a90a36dd0a3f1341da83 Mon Sep 17 00:00:00 2001 From: Radoslaw Burny Date: Tue, 21 Apr 2015 15:55:37 +0200 Subject: [PATCH] Add "string" to cppRawDelimiter group name This change fixes handling of raw strings in matchparen - a standard plugin that highlights matching parentheses. The bug that I'm fixing manifests in the following code: foo(bar( R"( )" ) ); If you move over parens in this code in Vim, you'll see that wrong ones are highlighted. This is because matchparen uses syntax highlighting to find (and skip) string literals. To be precise, it assumes that all string literals are highlighted with a syntax group whose name contains "string". Because we used "cppRawDelimiter", which does not contain "string" in it, parens in raw string delimiters confused the matchparen algorithm. --- syntax/cpp.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/cpp.vim b/syntax/cpp.vim index 78731d7..9ef2be4 100644 --- a/syntax/cpp.vim +++ b/syntax/cpp.vim @@ -46,7 +46,7 @@ if !exists("cpp_no_cpp11") syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE - syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell + syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell endif " The minimum and maximum operators in GNU C++ @@ -70,7 +70,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits") HiLink cppStructure Structure HiLink cppBoolean Boolean HiLink cppConstant Constant - HiLink cppRawDelimiter Delimiter + HiLink cppRawStringDelimiter Delimiter HiLink cppRawString String delcommand HiLink endif