vim-python / python-syntax

Python syntax highlighting for Vim
MIT License
438 stars 84 forks source link

Require format strings to use .format #68

Open Lilja opened 4 years ago

Lilja commented 4 years ago

First stab at #65. Defines a new root level matcher, pythonStringFormat. The name of this matcher I hope should resemble a string with an accompanying .format-function. Naming is a bit tricky since pythonFormat and pythonStrFormat are both taken.

This matcher tries to do a positive lookahead of .format if there are also strings begining with with ' or ".

No python 2 support. Personally I don't feel it's worth to add it, but if I can be persuaded to do so 😄

Before:

bild

After:

bild
Lilja commented 4 years ago

cc @nfnty

nfnty commented 3 years ago

I'd love for this functionality, but as it currently stands it's just not working correctly. If you want to tinker with this look for pythonString and try to implement a similar but custom syn-region but only for strings ending with .format(.