Colour highlighting in Geany for Python muti-line strings.

Python doesn’t have multiline comments, but triple quoted multiline strings are often used as comment blocks. These “comment blocks are enclised by triple quoting ”’ like this ”’. Geany, or more specifically Geany’s editing component Scintilla sees anythin inside quotes as an ordinary string and colours them accordingly. This is OK but it’s not ideal behaviour as I want my triple quoted blocks in comment colour.

I filed a bug at https://sourceforge.net/p/geany/bugs/1020/ then I withdrew the bug as not-a-bug, because it isn’t. It’s just that I required different behaviour to the standard (correct) way. The very usefule replies to my non-bug did fix my issue with the following suggestion.

First you need an alternate colour scheme in ~/.config/geany/colorschemes, I use geany-tango-dark.conf as it reduces eyestrain for me. In that file add a line triple=0x43D731;0x2e3436;false;false, It doesn’t matter where but I put it just below the comment group. Then in filetype.python add triple=triple in the [styling] section. Close and restart Geany. You should now see your multi-line strings/comments in the comment colour.

If this doesn’t suit your way of working, don’t do it. Don’t complain to me about it or tell me I’m doing it wrong.

This entry was posted in Uncategorized. Bookmark the permalink.