Honestly, raw string literals is a great addition to the C ++ language. But (as expected) itโs not easy for editors to correctly display these literals.
I am using Vim 7.4, and the original string literals completely break the syntax highlighting. For example, in
char const txt[] = R"(printf(")";
2nd '(' highlighted in red in vim.
Sort of
char const txt2[] = R"( "{{" )";
breaks the selection of braces and is based on the syntax auto-ident - etc.
For starters, I would be happy if Vim ignored everything between R"( )" when syntax highlighting.
But note that string string literals are flexible - arbitrary matching strings are allowed between the first / last double double carriage / brace, for example.
R"abcd()")")abcd"
also a valid string string literal that encodes
) ")"
See also the cppreference link for a general syntax definition.
So my question is how to configure Vim so that C ++ string literals are correctly recognized.
Vim already has some possibilities for the correct selection of fragments of the synatx language embedded in the host language (for example, for the source files of the compiler-compiler). Perhaps they can also be used for raw string literal?
source share