On Sun, 22 May 2022 at 11:20, John Gabriele <[email protected]> wrote: > > On Sat, May 21, 2022, at 7:21 PM, Lex Trotman wrote: > > On Sun, 22 May 2022 at 01:31, John Gabriele <[email protected]> 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: > >> https://github.com/ScintillaOrg/lexilla/blob/master/lexers/LexCPP.cxx > >> > >> 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` > > Ok. I opened that file (under Tools --> Configuration Files...). The file is > in my ~/.config/geany/ dir, and *every* line is commented out. > I uncommented line containing "[Extensions]", and then added one of > my own: > > ~~~ > Hare=*.ha; > ~~~ > > > 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 > > exactly. > > I'm not sure what you mean. I did this: > > cp /usr/share/geany/filedefs/filetypes.c > ~/.config/geany/filedefs/filetypes.Hare.conf
No, as I said, look at and copy one of the _custom_ filetypes files, not a builtin filetype file, one that looks like filetype.XXX.conf. Maybe start with filetypes.Swift.conf since it uses the C lexer. Also obviously whichever existing filetype file you copy you need to change the keywords lists unless your language has exactly the same ones. Cheers Lex > > I didn't edit anything in this file, but I see that it contains these > lines: > > ~~~ > [settings] > # default extension used when saving files > extension=c > ~~~ > > Is that something I need to change? > > > 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 > > user config. > > > >> 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 > > https://www.geany.org/manual/current/index.html#custom-filetypes. > > 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. > > > > Cheers > > Lex > > Thanks, Lex. I quit and restarted Geany, opened a .ha file, but it's > not syntax-highlighted. Though, I do see that under "Document --> > Set Filetype", there's a new checkbox there (under "None") that > says "Hare file", and it's checked! > > Is syntax highlighting separate from filetype? How can I get it > to syntax highlight the .ha file (using the same syntax highlighting > as C gets, I presume). > > -- John > _______________________________________________ > Users mailing list > [email protected] > https://lists.geany.org/cgi-bin/mailman/listinfo/users _______________________________________________ Users mailing list [email protected] https://lists.geany.org/cgi-bin/mailman/listinfo/users
