Using keywordclass2 in Python
Jim Hill <jim.hill.au <at> gmail.com>
2008-10-07 05:16:48 GMT
Hi
This may have been explained before, but i didn't find it.
To make some Python keywords have a different colour, this works:
Put the following lines in python.properties
---------
keywordclass2.python= <move some words here from keywordclass.python>
keywords2.$(file.patterns.py)=$(keywordclass2.python)
keywords2.$(file.patterns.scons)=$(keywordclass2.python)
---------
Also make sure that a line starting with
style.python.14=
exists, is not commented out, and has a useful value.
I don't know if the scons line is necessary; I simply
duplicated what was already there for 'keywords'
======================
Replacing some existing lines, this is what I actually use now:
---------
keywordclass.python=and as assert class def del elif else \
except exec finally for from global if import in is \
lambda None not or pass print try while with
keywordclass2.python=break continue return yield raise exit
keywords.$(file.patterns.py)=$(keywordclass.python)
keywords.$(file.patterns.scons)=$(keywordclass.python)
keywords2.$(file.patterns.py)=$(keywordclass2.python)
keywords2.$(file.patterns.scons)=$(keywordclass2.python)
---------
Lower down, in the styles section:
---------
# Highlighted identifiers (keywords2)
style.python.14=fore:#9F0000,bold
---------
======================
You can put whatever you like in keywordclass2.python
I put keywords that break program flow, to make them stand out.
('exit' isn't a Python keyword; no problem, it still comes up red.)
style.python.14 sets the appearance of keywords2
======================
Neil, would it be helpful to put something like the following
in python.properties for future releases?
-----
# If you put some words after "keywordclass2.python="
# and uncomment the subsequent 2 lines, those words
# will be styled according to style.python.14
#keywordclass2.python=
#keywords2.$(file.patterns.py)=$(keywordclass2.python)
#keywords2.$(file.patterns.scons)=$(keywordclass2.python)
-----
======================
I figured this out last week with help from
a couple of previous posts (forget which now, sorry)
and a squizz at some scite source code.
It took a couple of hours to figure it out,
so I hope this will save time for many others.
Regards
Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---