C++11 raw string literal syntax hightlighting
-
I just started using C++11 raw string literals and I was surprised notepad++ does not highlight them as strings.
Example: R"(my string, no need to double the backslash)"
I know it works fine for python.
Is it true or something went wrong the last time I updated notepad++ (it already happen, my global styles are modified and the update process failed to merge the two styles)? -
@Lionel-Lagarde said in C++11 raw string literal syntax hightlighting:
Is it true or something went wrong the last time I updated notepad++ (it already happen, my global styles are modified and the update process failed to merge the two styles)?
Nothing went wrong. Just nobody has pointed out to the developer that the entry for
name="STRINGRAW" styleID="20"should be added to the stylers/themes.If you want to add it yourself,
- Exit Notepad++ app completely
- If you are using a theme other than
stylers.xml, check if you have a copy in%AppData%\Notepad++\themes\– if not, copy fromC:\Program Files\Notepad++\themes\to the AppData path (create the themes folder if needed)- you don’t want to edit the copy in the installation directory, because your next update will just lose that
- Open Notepad++, and edit either
%AppData%\Notepad++\stylers.xmlor%AppData%\Notepad++\themes\<YourThemeHere>.xml - Search for
name="cpp" - Add in the following line, picking whatever color you want (maybe something similar to the STRING or CHARACTER color, but it’s up to you; my example was based on the same as the default stylers.xml STRING color, but added slightly more red to the grey tint):
<WordsStyle name="STRINGRAW" styleID="20" fgColor="A08080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize=""></WordsStyle>
With that, I can get Notepad++ to highlight the raw string literal:

If someone (like you) were to put in an official feature request (checking if one exists first; if it already does, upvote it, and put a link here), it wouldn’t be hard for a interested contributor to work up a quick PR to add that missing style to the stylers/themes for a future version of Notepad++. (And with N++ now automatically adding missing styles to your local themes the next time you update, it would be made available to everyone.)