1

Online all the examples for Geany have syntax coloring, but I couldn't figure out how to enable this feature. I downloaded Geany, then created a new python file, but whenever as I type a keyword, number, string, ... the color stays black even after saving. Do I have to install an additional plug-in or is there an option somewhere to enable coloring?

3
  • To enable syntax highlighting ,save the file before coding......refer here.....It will automatically highlight syntax
    – Ravan
    Aug 27, 2015 at 1:41
  • @Ravan, did not work if you highlight one variable and would like to see all variables with the same name highlighted.
    – Timo
    Oct 26, 2017 at 7:58
  • I found on the geany plugins docu website a third party login which treats the highlightword problem. There is a difference between syntax coloring and highlighting, my fault.
    – Timo
    Oct 26, 2017 at 8:53

3 Answers 3

4

The "coloring" is called syntax highlighting and it is based on the detected file type. The file type detecting pretty much works on two paths:

  1. from file extension. So a file with extension .py is recognized as Python file. This can be configured via Tools->Configuration Files->filetypes_extensions.conf
  2. from manual choice from inside Document menu. So e.g. "Document->Set Filetype->Scripting Languages->Python source file" for setting Python

In some cases the so called shebang -- the #!/bin/... at the start of a file -- is also used to determine the file type.

In your case, you should ensure you have saved your file with a extension marked as Python and/or choose manually.

1

There is a great collection of syntax highlight themes on Github. Please check:

https://github.com/codebrainz/geany-themes

Just follow the Unix-like Installation section:

Extract the tarball and copy all of the files in the colorschemes directory to your ~/.config/geany/colorschemes/ directory. Create that directory if it doesn't already exist.

3
  • Is this really related to syntax highlight or to color themes in general appearance (dark, light, etc.)?
    – Timo
    Oct 26, 2017 at 7:48
  • 1
    @Timo Title on the github is misleading - it's related to syntax highlighting. Oct 26, 2017 at 8:33
  • Thanks, I found on the geany plugins docu website a third party login which treats the highlightword problem.
    – Timo
    Oct 26, 2017 at 8:50
0

Besides connecting the file extension to a file type (like mentioned in frian's answer), there is a general setting that was overseen by me. Make sure that in

  • View --> Color Schemes...

there's not an entry selected that says "null" as the bracketed value. Im my case, this was: "github.conf (null)". You can either pick one of "Standard" or "Alternate" or even add further color schemes as described in Michal's answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .