Re: [gedit-list] customize script highlighting by file extensions


Max Chalfin a écrit le 2011-09-21 10:45 :
> I find that gedit does not automatically recognize certain file
> extensions for highlight mode.  In particular it does not know that
> *.r should be highlighted as an R script.  I would like to fix this,

Strange. Language definition for R can be found here (note: I don't know
if paths are different on FreeBSD; below I'll use paths on Ubuntu):


This file contains information to highlight R files, among others file extensions:

<property name="globs">*.R;*.Rout;*.r;*.Rhistory;*.Rt;*;*</property>

For example, according to the line above, the following files will be
automatically highlighted as R files:


So in theory, if there's no bug, *.r should be automatically highlighted.

> as well as add my own file extensions for shell scripts, and not be
> limited to *.sh.

You can copy the following file:


and paste it on the following emplacement (create folders if they don't
yet exist):


Then, find the line corresponding to the extensions, something like:

<property name="globs">*.sh</property>

and add your own extensions, for example:

<property name="globs">*.sh;*.sh1;*.sh2</property>

> Furthermore, I have found that the shell scripting highlight mode recognizes bash syntax but not tsch.  Can this be customized?

Yes. Open the above file used to custom shell language:


There are various sections about the language definition. You can customize
them or add others. Explanations can be found here:



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