[Geany-Users] Setting a lexer and colors for None filetype
Jake Richards
blaven at xxxxx
Fri Nov 8 21:51:10 UTC 2013
Lex Trotman <elextr at ...> writes:
>
>
>
> On 9 November 2013 04:35, Jake Richards <blaven-
Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> 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 listUsers-
cnFmAm88PdhNzA81UIdiqw at public.gmane.orghttps://lists.geany.org/cgi-
bin/mailman/listinfo/users
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at ...
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
>
Thanks for the reply! It looks like option 2 might be my best bet as the
logs do have a pretty unique first line. I'll check the docs for that regex
for the filetype. Thanks again!
Jake
More information about the Users
mailing list