4

I heard someone had set up their editor to highlight python raw strings as regular expressions, e.g. for Django:

urls(r'^site1/(\d)*/new$'', ...)

Unfortunately my googleing doesn't get me anything. Is this possible in vim?

4
  • I'm not sure to really see what you're trying to do but have you tried to put this line in your vimrc let python_highlight_all = 1? Also for enhanced python highlightinh see here
    – statox
    Commented Aug 10, 2015 at 13:14
  • 1
    What I meant was, the regular expression within the url function call up there should receive its own syntax highlighting, marking e.g. groupings in one colour, colour the parentheses, the asterisk, etc. Not just highlight it in one colour as a string (and maybe a second colour for "\n", "\r" etc.). python_highlight_all does nothing and I cannot find it in the help system. The linked enhanced python highlighting also doesn't do this.
    – yggdrasil
    Commented Aug 10, 2015 at 15:48
  • Ok, so I'd say that what you want is to extend the highlighting so maybe this link explaining how to create your own syntax file could help (basically it explains how to match some regex and color them the way you want). Otherwise sorry if that didn't help.
    – statox
    Commented Aug 10, 2015 at 16:00
  • Is the '' at the end of the string deliberate or a typo? I imaging this can be done, since Vim highlights regexes in Vimscript files.
    – muru
    Commented Apr 9, 2016 at 8:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.