b4n left a comment (geany/geany#4396)

> Thanks for the encouragement and suggestions :) After all, once one as 
> manually set the file type to “Shell,” writing YSH is already reasonably 
> handy. I will address syntax highlighting later if I succeed; for now, I am 
> just trying to get Geany to recognize Oils scripts by automatically 
> activating the native Shell filedef.

The advantage of a custom filetype as @eht16 suggested is that you can define 
specific keywords, build menu, etc. The highlighting part is gonna be inherited 
mostly from e.g. the Shell filetype, you won't be able to define syntactic 
elements this way (syntax highlighting is done by a piece of C++, and symbols 
parsing by some C -- but this later one can actually define regular expressions 
to do the actual parssing -- that's doable but requires more than just creating 
one configuration file)

> By copying the `filetype_extensions.conf` file from /usr to my /home and 
> adding `*.osh;*.ysh;` to the value of the `Sh` key, I managed to obtain this 
> for all the scripts that have a Oils extension in their filename. (I'm not 
> sure if this is the correct way, though)

It is the right way. A handier but equivalent solution is to open this file 
from the Tools → Configuration files menu, which will automatically make a copy 
if there is no user file.

> In other cases, when for example a file contains the shebang `#! /bin/bash` 
> but no extension in his filename, Geany still automatically selects the 
> `Shell` type, whether executable or not. How can I set Geany to do the same 
> if my script has no extension in the filename but only contains the shebang 
> `#! /bin/ysh`?

Unfortunately this requires modifying Geany's source code ATM.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/4396#issuecomment-3185794796
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/issues/4396/[email protected]>

Reply via email to