[Geany-Users] filetype, lexer, config file: using a new language
elextr at gmail.com
Sat May 21 23:21:33 UTC 2022
On Sun, 22 May 2022 at 01:31, John Gabriele <jgabriele at fastmail.fm> wrote:
> Hi all,
> I'd like to use the [Hare](https://harelang.org/) programming language
> with Geany. I see that the C syntax highlighting works ok so far (and
> it appears that [Lexilla](https://github.com/ScintillaOrg/lexilla)
> (which I understand Geany makes use of) supports C, C++, Java, and JS
> all using the same lexer:
> Anyhow, when I open a .ha file (Hare source file) with Geany, I'd like
> for it to just use the C syntax highlighting automatically, so I don't
> have to manually select it each time. How can I get that to work?
You also need to specify the filetype in `filetype_extensions.conf`
and note the filetype name you use there and the filetype name used in
the `filetype.XXX.conf` filename are case sensitive and must match
Note that you can open `filetype_extension.conf` in the menu
`Tools->Configuration Files` and it will open the one in your user
config, or the system one if no user one yet, but always saves to your
> I'm on GNU/Linux, and I see that I've got a ~/.config/geany directory.
> Looking at the manual, I don't understand the different axes of
> filetype def files vs config files ...
> I see that I have a /usr/share/geany/filedefs/filetypes.c file.
> Do I copy that to my ~/.config/geany/filedefs dir? After that, what
> do I change in that file?
Correct target directory, but what you need is a "custom filetype"
which can specify which lexer and/or existing parser to use, see
There are examples of custom filetypes in the system filedefs
directory, eg Scala.
> Also, why do some of the files in /usr/share/geany/filedefs end in
> .conf while others don't?
Custom filetypes vs builtin filetypes.
> Users mailing list
> Users at lists.geany.org
More information about the Users