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 Answers
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:
- 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
- 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.
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.
-
Is this really related to syntax highlight or to color themes in general appearance (dark, light, etc.)?– TimoOct 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.– TimoOct 26, 2017 at 8:50
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.
highlightword
problem. There is a difference between syntaxcoloring
andhighlighting
, my fault.