Re: [Geany-Users] Help: Custom syntax highlighting file.

2013-09-03 Thread Lex Trotman
Hi,

Couple of comments below.

Cheers
Lex


On 3 September 2013 19:59, Daniel Carrera dcarr...@gmail.com wrote:

 Hello,

 I want to add syntax highlighting for Gnuplot files. I have made an
 effort to follow the documentation but the syntax highlighting doesn't
 work. My guess is that I got the file contents wrong. I am using the
 instructions in the manual:

 http://www.geany.org/manual/dev/index.html#custom-filetypes

 As instructed, I edited  filetype_extensions.conf  and inserted the
 following line:

 Gnuplot=*.plt;*.gp;

 I also created filetypes.Gnuplot.conf and I have every indication that
 Geany can in fact read this file:

 1) I now have a new menu entry: Document  Set Filetype  Gnuplot file.
 2) Geany seems to recognize that a file with the .plt or .gp extension
 is a Gnuplot file (it says Gnuplot on the status bar).
 3) All this stops working if I remove filetypes.Gnuplot.conf

 So clearly Geany can see the file. But I do not have any kind of
 syntax highlighting that I can see. So I suppose that my file contents
 are wrong. Here is the file. Can anyone see an obvious problem with
 it?

 -- // --
 # For complete documentation of this file, please see Geany's main
 documentation
 [styling]


It is better to use named styles rather than setting hard colours, then
your filetype will also adapt with loaded colour schemes.



 # foreground;background;bold;italic
 default=0x00;0xff;false;false
 commentline=0xd0;0xff;false;false
 number=0x007f00;0xff;false;false
 word=0x99;0xff;true;false
 string=0xff901e;0xff;false;false
 character=0x404000;0xff;false;false
 operator=0x301010;0xff;false;false
 identifier=0x00;0xff;false;false
 backticks=0x00;0xd0d0d0;false;false
 param=0x009f00;0xff;false;false
 scalar=0x105090;0xff;false;false
 error=0xff;0xff;false;false
 here_delim=0x00;0xddd0dd;false;false
 here_q=0x7f007f;0xddd0dd;false;false


 [keywords]
 primary=at help plot set terminal eps png svg enhanced plot key top
 down left right label xlabel ylabel xrange yrange


 [settings]


To get highlighting you need to specify a lexer using the lexer_filetypes
setting, see http://www.geany.org/manual/current/index.html#settings-section

Since there isn't a GNUPlot lexer you need to specify something close
enough.




 # default extension used when saving files
 extension=plt

 # the following characters are these which a word can contains, see
 documentation
 #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

 # single comments, like # in this file
 comment_single=#
 # multiline comments
 #comment_open=
 #comment_close=

 # set to false if a comment character/string should start a column 0
 of a line, true uses any
 # indentation of the line, e.g. setting to true causes the following
 on pressing CTRL+d
 #command_example();
 # setting to false would generate this
 #   command_example();
 # This setting works only for single line comments
 comment_use_indent=true

 # context action command (please see Geany's main documentation for
 details)
 context_action_cmd=

 [indentation]
 #width=4
 # 0 is spaces, 1 is tabs, 2 is tab  spaces
 #type=1

 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension
 # (use only one of it at one time)
 run_cmd=./%f
 -- // --

 Thanks for the help.

 Cheers,
 Daniel.
 ___
 Users mailing list
 Users@lists.geany.org
 https://lists.geany.org/cgi-bin/mailman/listinfo/users

___
Users mailing list
Users@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users


Re: [Geany-Users] Help: Custom syntax highlighting file.

2013-09-03 Thread Daniel Carrera
Hi Lex,

 It is better to use named styles rather than setting hard colours, then your
 filetype will also adapt with loaded colour schemes.


Ok. I found an example of that in filetypes.Python and I copied it.

 To get highlighting you need to specify a lexer using the lexer_filetypes
 setting, see http://www.geany.org/manual/current/index.html#settings-section

 Since there isn't a GNUPlot lexer you need to specify something close
 enough.

Ok. I tried to do this. I can get several lexers working (Perl,
Python, C, Tcl) but the Bash lexer doesn't seem to do anything. No
matter, the Perl and Python lexers seem to work fine.

Thanks!

Cheers,
Daniel.
___
Users mailing list
Users@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users


Re: [Geany-Users] Help: Custom syntax highlighting file.

2013-09-03 Thread Matthew Brush

On 13-09-03 04:30 AM, Daniel Carrera wrote:

Hi Lex,


It is better to use named styles rather than setting hard colours, then your
filetype will also adapt with loaded colour schemes.



Ok. I found an example of that in filetypes.Python and I copied it.



Depending which lexer you use, the style definitions will be different, 
so if you copied Python's [styling] section but then used the Perl 
lexer, it probably won't work too good (except maybe for really common 
stuff like comments, normal strings, etc). To get an idea where these 
names come from you'd have to look inside 
`scintilla/include/Scintilla.iface` and `src/highlightingmappings.h` 
files in Geany's source tree.



To get highlighting you need to specify a lexer using the lexer_filetypes
setting, see http://www.geany.org/manual/current/index.html#settings-section

Since there isn't a GNUPlot lexer you need to specify something close
enough.


Ok. I tried to do this. I can get several lexers working (Perl,
Python, C, Tcl) but the Bash lexer doesn't seem to do anything. No
matter, the Perl and Python lexers seem to work fine.



It depends on a) having a language that's close enough to your 
language that the given lexer can understand enough to get some useful 
highlighting and b) having the right stuff in `[styling]` that 
corresponds to your lexer, which is easier to do like 
`[styling=AnotherFiletype]` to copy from the true filetype, for example 
see filetype.Cython.conf.


Cheers,
Matthew Brush

___
Users mailing list
Users@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users