Make Geany recognize additional file extensions
Asked Answered
N

3

19

My default Geany installation on Debian does not recognize some file types out of the box. How can I add extensions, using the same syntax highlighting as other known extensions for simplicity's sake?

In the current case, I'd like Geany to open all .aspx files with the same highlighting as .html files.

Nerveless answered 1/12, 2013 at 19:58 Comment(0)
T
27

Use inside the menu Tools->Configuration files->filetype_extensions.conf. This will allow you to configure the filetypes based on suffix for your user.

Timoteo answered 2/12, 2013 at 15:2 Comment(1)
Thanks! I'd missed that option.Nerveless
P
5

I had trouble accomplishing this without help from here.

Go here to read documentation about this topic.

From the Geany menu, go to:

Tools > Configuration Files > filetype_extensions.conf

Go to this line and un-comment it:

#~ [Extensions]

So that it just reads:

[Extensions]

I was needing to add .mjs as an additional extension for javascript. So, for me, I also uncommented this line:

#~  Javascript=*.js;

And changed it to:

Javascript=*.js;*.mjs;

After this, I saved the file.

Now when I opened files having a .mjs file extension, they automatically have Javascript Syntax Highlighting.

I made some suggestions to improve this expeirience here.

Picker answered 7/7, 2022 at 12:48 Comment(1)
Thank you, this solved the problem for me. I figured that # might be a comment mark, so I tried but it didn't work because I was uncommenting one of the bottom ones so I missed the [Extensions] line at the start. They should really add a line saying that you need to uncomment stuff at the start of that file.Koo
P
1

Just add new extensions in /usr/local/share/geany/filetype_extensions.conf

Peaceable answered 2/12, 2013 at 11:40 Comment(3)
Didn't work for me. My Geany is reading the configuration from ~/.config/geany/filetype_extensions.conf Maybe as I tried first frlan answer it created a copy of master configuration file, I must try it again on a clean installation or live CD. Anyways I prefer frlan's way as it's more accessible and skips editing root owned files. But thanks a lot anyways.Nerveless
This solution will modify global configuration which might ends up in confusing at other users if having a multi user system. I'd really not recommend doing like that unless you really got a good reason for. Use the functions from inside the tools menu and you don't have to fuzzy around on your system and its working also on Windows.Timoteo
Thanks, although 2023 update: I think this is not anymore the way ("No such file or directory"), Lonnie Best's solution above worked for me.Sholeen

© 2022 - 2024 — McMap. All rights reserved.