Yurij73
Yurij73

Reputation: 5611

Using a non-default color shema for gedit syntax highlighter

I wrote a simple gedit xml lang file for do highlighting source code. When i use constructions like

<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>

it always color comments blue and keywords brown. I would instead like my comments green and keywords red. How can I do that?

I also noticed some schemas under /usr/share/gtksourceview-2.0/styles:

classic.xml  cobalt.xml  kate.xml  oblivion.xml  styles.rng  tango.xml

How can I use these in my lang file?

Upvotes: 2

Views: 678

Answers (1)

Micah Carrick
Micah Carrick

Reputation: 10197

The lang files do not describe styles. The lang defines the language (this is a keyword, this is comment, etc.) and the style describes how to display those things (make comments green, make keywords blue and bold, etc.). It's up to the end user to choose the style based on there preferences.

You can select a style in the Gedit preferences dialog. As it happens, the "Kate" style does color comments green and keywords red, so you should use that one.

Take note that the paths for where you store the style and lang files is different in Gedit 2 and Gedit 3 (GTK+ 2 and GTK+ 3).

Upvotes: 4

Related Questions