Re: [gedit-list] syntax highlighting for Igor Pro



Op vrijdag 12-09-2008 om 12:11 uur [tijdzone +0100], schreef Alex
Bartel:
> Dear Durand, you can create syntax highlighting rules for any language by 
> creating an XML file with the appropriate name. Go to 
> /usr/share/gtksourceview-2.0/language-specs/ (at least that's where I have 
> to go on my machine) or search for files which end with .lang and go into 
> their folder. There you can create your own file, presumably call it 
> something like igor_pro.lang and specify the highlighting rules. 

You can also specify the language file in
~/.local/share/gtksourceview-2.0/language-specs

Mind that these are gsv 2.0 language files, if you have an old version
of gedit, you might need to write files in the gsv 1 sytanx at the gsv1
location. You can easily check this by checking your version of gedit,
we switched to gsv2 at 2.20.

After you write the language, you also will need to map your file to a
new mime-type to let gedit automatically detect the correct language it
should use. You can also manually select the highlighting language after
you openened the file, but this gets cumbersome. To do this you will
need to write a file in ~/.local/share/mime/packages/ called something
like igorpro.xml and should contain the following:

<?xml version='1.0'?>
<mime-info
xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/x-igorpro">
    <comment>Igor Pro source</comment>
    <glob pattern="*.pro"/>
  </mime-type>
</mime-info>

After you've done this, you go into ~/.local/share/mime and execute
'update-mime-database .'. This should install the mime type and make it
available to gedit. In the language file you can now do:

<metadata>
      <property name="mimetypes">text/x-igorpro;</property>

This will map the correct mime type and should let gedit autodetect the
correct language for .pro files.

I'm sorry as this might sound like quite some work just to create a new
lang file. We hope to make this process easier in the near future since
it has been requested often. If anything doesn't work out, please
contact the mailing list, or visit us on IRC and we'll help you if we
can.


Jesse


-- 
Jesse van den Kieboom

Personal: http://www.icecrew.nl
Professional: http://www.novowork.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]