I am using Winedt 7.1
and learning TikZ
and I am thinking about to add the commands to the keyword.ini
, in the help they mentioned, adding to many keywords may affect the performance. Is there a possibility that the TikZ-Commands
are only highlighted inside a tikzpicture environment?
1 Answer
Update (2017-02-14)
WinEdt version 10.2 implements a new feature: environment-sensitive modes.
This means that you have the chance to define highlighting properties specific to some environments only.
Thank to this new feature, a TikZ
mode has been implemented, with an highlighting scheme borrowed from the one used in the pgf
manual. Here's it in action:
This is an example which defines an "highlight switch" for the tikzpicture
environment in the configuration file Switches.ini
:
SWITCH="\begin{tikzpicture} .. \end{tikzpicture}"
ENABLED=1
MODE_FILTER="TeX|AUX"
SET_LOCAL_MODE="*:TikZ"
START="\"
STOP="\"
HIGHLIGHT_START=0
STEP_OVER_STOP=1
HIGHLIGHT_STOP=0
SCOPE=4
DOMINANT_PRIORITY=0
STRICT_PRIORITY=0
PRIORITY=5
INDENTED=1
BOLN_ONLY=0
CASE_SENSITIVE=1
START1_TRIGGER=""
START2_TRIGGER="begin{tikzpicture}"
STOP1_TRIGGER=""
STOP2_TRIGGER="end{tikzpicture}"
TEXT_COLOR="sclWindowText"
DEFAULT_FONT=1
CUSTOM_BACKGROUND=1
GRADIENT_BACKGROUND=256
TRANSPARENT=128
GRADIENT_COLOR="xclEnvBkLeftGradient"
BACKGROUND_COLOR="xclEnvBk"
RELATIVE_RIGHT_MARGIN=1
RIGHT_MARGIN=0
INDENTED_LEFT_MARGIN=1
LEFT_MARGIN=2
Note the line
SET_LOCAL_MODE="*:TikZ"
which enters the TikZ
mode.
Now, if you want to define your own keywords to be highlighted only inside these kind of environments, all you have to do is to define a "keyword group" in the configuration file "Keywords.ini" like this:
KEYWORD_GROUP="My TikZ Keywords"
ENABLED=1
MODE_FILTER="TikZ"
BEFORE="\ (single)"
AFTER="~Alpha@"
BOLN_NOT_OK=1
EOLN_NOT_OK=0
HIGHLIGHT_START=1
STRICT_PRIORITY=0
PRIORITY=6
CASE_SENSITIVE=1
TEXT_COLOR="kwcTikZKeywords"
DEFAULT_FONT=1
LIST="END_LIST"
<my list of keywords>
END_LIST
Note the line
MODE_FILTER="TikZ"
which means that these keywords are highlighted only when inside the TikZ
mode.
Original answer
As far as I know, it is not possible to add environment-specific keywords in WinEdt.
Anyway, unless you have a very old computer and you add thousands of keywords, you will not see any particular slowdown in WinEdt's performance.