[Geany-Users] Setting a lexer and colors for None filetype

Lex Trotman elextr at xxxxx
Fri Nov 8 21:02:11 UTC 2013


On 9 November 2013 04:35, Jake Richards <blaven at gmail.com> wrote:

> Hello:
>   I have a bunch of log files that unfortunately do not have extensions.
>  So, when geany opens them, they are using the fileType:None, which I
> assume gets it's colors from the filetypes.common?  It seems though that I
> can't seem to make any changes that affect my log file.  The colors are
> always the default (all text black over white). I'd love to at least have
> some simple lexer installed so numbers and strings are color coded or even
> define a few keywords to hilite.  Is there a way to specify a lexer for the
> None filetype?
>

No (unless you want to do lots of C coding, in which case you can do
anything :)

>
> As a second somewhat related question.  I have the lua plugin loaded and
> my logs are always in a certain folder.  Is it possible to set the fileType
> using lua and the open event?  I couldn't find the command in the lua geany
> docs.
>

It doesn't seem so.

To identify the file you could either:

1. write a script to give the logs an extension and add that to
filetypes.extensions, eg .fred, or

2. if something unique appears in the first few lines of the log file
modify the filetype extraction regex to get a "filetype", eg if "fred
bloggs loggs" appears in the file use "(fred) bloggs loggs" as the regex to
get filetype "fred"

Now you have a filetype you can write a custom filetype based on an
existing filetype and lexer that works "well enough", see the manual.

Cheers
Lex


> Thanks!
> Jake
>
> _______________________________________________
> Users mailing list
> Users at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/users/attachments/20131109/04a5ff5f/attachment.html>


More information about the Users mailing list