The single-letter prefixes in Python3 are a bit nuts, and get lost in the code.
I played aroung a bit and found that I can add a pythonStringModifier group to catch these (and highlight them in a strong color, like Operator).
The solution requires defining said group as contained and adding that group to the contains list for all of the various string groups defined in the syntax file. Here's a snippet for after/syntax/python.vim that doesn't cover python 2 or multi-letter cases like fr". Maybe such an approach could be added in a more complete way to support this, if there is interest.
synmatchpythonStringModifier'\<[brf]"'me=e-1containedsynregionpythonFStringstart=+[fF]'+skip=+\\\\\|\\'\|\\$+excludenlend=+'+end=+$+keependcontains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell,pythonStringModifiersynregionpythonFStringstart=+[fF]"+skip=+\\\\\|\\"\|\\$+excludenlend=+"+end=+$+keependcontains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell,pythonStringModifiersynregionpythonFStringstart=+[fF]'''+skip=+\\'+end=+'''+keependcontains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell,pythonStringModifiersynregionpythonFStringstart=+[fF]"""+skip=+\\"+end=+"""+keependcontains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell,pythonStringModifiersynregionpythonBytesstart=+[bB]'+skip=+\\\\\|\\'\|\\$+excludenlend=+'+end=+$+keependcontains=pythonBytesError,pythonBytesContent,@Spell,pythonStringModifiersynregionpythonBytesstart=+[bB]"+skip=+\\\\\|\\"\|\\$+excludenlend=+"+end=+$+keependcontains=pythonBytesError,pythonBytesContent,@Spell,pythonStringModifiersynregionpythonBytesstart=+[bB]'''+skip=+\\'+end=+'''+keependcontains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell,pythonStringModifiersynregionpythonBytesstart=+[bB]"""+skip=+\\"+end=+"""+keependcontains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell,pythonStringModifiersynregionpythonRawStringstart=+[rR]'+skip=+\\\\\|\\'\|\\$+excludenlend=+'+end=+$+keependcontains=pythonRawEscape,@Spell,pythonStringModifiersynregionpythonRawStringstart=+[rR]"+skip=+\\\\\|\\"\|\\$+excludenlend=+"+end=+$+keependcontains=pythonRawEscape,@Spell,pythonStringModifiersynregionpythonRawStringstart=+[rR]'''+skip=+\\'+end=+'''+keependcontains=pythonDocTest,pythonSpaceError,@Spell,pythonStringModifiersynregionpythonRawStringstart=+[rR]"""+skip=+\\"+end=+"""+keependcontains=pythonDocTest2,pythonSpaceError,@Spell,pythonStringModifierhilinkpythonStringModifierOperator
The single-letter prefixes in Python3 are a bit nuts, and get lost in the code.
I played aroung a bit and found that I can add a
pythonStringModifiergroup to catch these (and highlight them in a strong color, likeOperator).The solution requires defining said group as
containedand adding that group to thecontainslist for all of the various string groups defined in the syntax file. Here's a snippet forafter/syntax/python.vimthat doesn't cover python 2 or multi-letter cases likefr". Maybe such an approach could be added in a more complete way to support this, if there is interest.