[Geany] Several keyword styles per filetype

Nick Treleaven nick.treleaven at xxxxx
Wed Feb 10 12:23:41 UTC 2010


On Tue, 09 Feb 2010 20:45:45 +0100
Wolfram Kläger <wolfram.klaeger at web.de> wrote:

> > It depends on the filetype lexer used for syntax highlighting. Some
> > support more than one keyword set. Have a look at the system filetype
> > to see what entries are listed under keywords, those are the only ones
> > you can override.
> 
> Unfortunately, I'm not sure how to understand this. I tried to twiddle 
> the filetypes.pascal settings.

I said to look under keywords:

[keywords]
# all items must be in one line
primary=absolute abstract add and array as asm assembler automated
begin byte ca se cdecl char...

There is only the 'primary' keyword set there, so for Pascal there is
only one keyword set possible, hence no word2 style.

To take another example, C:

[keywords]
# all items must be in one line
primary=asm auto ...
secondary=
# these are some doxygen keywords (incomplete)
docComment=attent...

The C scintilla lexer supports 3 keyword sets, so there are three
corresponding styles:
word
word2
commentdockeyword

> Looking at the original file, the style 
> list is
> 
> [styling]
> > # foreground;background;bold;italic
> > default=0x000000;0xffffff;false;false
> > identifier=0x000000;0xffffff;false;false
> > comment=0xd00000;0xffffff;false;false
> > comment2=0x3f5fbf;0xffffff;false;false
> > commentline=0xd00000;0xffffff;false;false
> > preprocessor=0x007f7f;0xffffff;false;false
> > preprocessor2=0x007f7f;0xffffff;false;false
> > number=0x007F00;0xffffff;false;false
> > hexnumber=0x007F00;0xffffff;false;false
> > word=0x111199;0xffffff;true;false
> > string=0xff901e;0xffffff;false;false
> > stringeol=0x000000;0xe0c0e0;false;false
> > character=0x404000;0xffffff;false;false
> > operator=0x301010;0xffffff;false;false
> > asm=0x804080;0xffffff;false;false
> 
> I am allowed to adjust the style "word", but I am not allowed to 
> introduce a new line
> 
> word2=0xsomething
> 
> right?
> 
> If I was a C programmer, for instance, I were lucky and could adjust 
> both predefined styles, "word" and "word2", right?
> 
> If it's that easy, just throw a couple of
> 
> word*....
> 
> lines in all filetype specs, please!

It's not that easy, the Scintilla (editing component) only supports a
fixed set of keywords for each lexer, some only have one. It could be
that Geany doesn't support all of the Scintilla keyword sets, but
usually we are quite up to date.

> But don't forget to update the manual, how I am supposed to assign these 
> styles in my [keywords] section :)

http://www.geany.org/manual/dev/index.html#keywords-section

What else should we add?

Regards,
Nick



More information about the Users mailing list