Is there any way to do this ? I'm using vim 8.2 with this python plugin. The inside of f strings for example is correctly highlighted but not the "f"
Syntax highlighting is a relatively deep subject and extending an existing highlighting scheme may get complicated depending on certain factors. I recommend you find a good reference and read up on things. One highly regarded source of information is Learn Vimscript the Hard Way which has three chapters (45-47) devoted to the topic
With that being said, I suspect this particular case can be handled fairly easily since a standalone "f", "b", "r" or "u" is pretty unique (i.e. unlikely to occur elsewhere in Python source code).
Here's a "quick and dirty" solution that works for me...
First, since you are just supplementing the existing configuration, create an "after" file to contain the new config:
~/.vim/after/syntax/python.vim. Edit this file and add these two lines...
syntax match pythonStrFormatTag /\<[brfu]\>/ highlight link pythonStrFormatTag Special
The first line defines a regex pattern to match the letters of interest. The surrounding
\> prevent a match when those letters are part of a word. If you want to use a slightly more refined pattern you could try
\<[brfu]\>\ze['"] which will require a single or double quote after the letter but, thanks to the
\ze, will not include it in the text to color.
Special with any existing highlight group that has a color scheme that you like. Run
:hi while editing a Python file to see what's available.
That's it. I just did a quick sanity test and it works but let me know if there are any issues. (The pattern might need a bit of refinement if there's a conflicting match that I didn't consider.)