The first part of the the answer is clear from the comments above.
WinEdt only recognises verbatim
as a "verbatim" environment. If you want more control on these kind of environments you have to install the plugin of mine VerbatimPlus. With this, you have support for environments coming from the following packages: listings
, moreverb
, verbatim
and fancyvrb
.
Now, if you want to add your personal environments to the list of supported ones, follow these steps. Let's suppose that you have created a new environment cplusplus
through the \lstnewenvironment
command.
Go to "Options" -> "Options Interface" and double-click the "Switches" item:

A local copy of Switches.ini
gets opened. In this file, let's say after the lines
SWITCH="\begin{verbatim*} .. \end{verbatim*}"
ENABLED=1
MODE_FILTER="TeX|INS;STY;AUX"
START="\"
STOP="\"
HIGHLIGHT_START=0
STEP_OVER_STOP=1
HIGHLIGHT_STOP=0
SCOPE=4
DOMINANT_PRIORITY=0
STRICT_PRIORITY=1
PRIORITY=9
INDENTED=0
BOLN_ONLY=0
CASE_SENSITIVE=1
VERBATIM=1
START1_TRIGGER=""
START2_TRIGGER="begin{verbatim*}"
STOP1_TRIGGER=""
STOP2_TRIGGER="end{verbatim*}"
TEXT_COLOR="xclVerbatim"
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=0
LEFT_MARGIN=0
add the following lines
SWITCH="\begin{cplusplus} .. \end{cplusplus}"
ENABLED=1
MODE_FILTER="TeX|INS;STY;AUX"
START="\"
STOP="\"
HIGHLIGHT_START=0
STEP_OVER_STOP=1
HIGHLIGHT_STOP=0
SCOPE=4
DOMINANT_PRIORITY=0
STRICT_PRIORITY=1
PRIORITY=9
INDENTED=0
BOLN_ONLY=0
CASE_SENSITIVE=1
VERBATIM=1
START1_TRIGGER=""
START2_TRIGGER="begin{cplusplus}"
STOP1_TRIGGER=""
STOP2_TRIGGER="end{cplusplus}"
TEXT_COLOR="xclVerbatim"
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=0
LEFT_MARGIN=0
As you can see, the word "cplusplus" appears 4 times in the above code. Replace them with your custom environment name. Repeat it for all your custom environments.
At this point press Shift+Ctrl+F9 to reload the file.
That's all. Now your custom environments are not taken into consideration when building the document's tree.
listings
, as shown above. – fajar Nov 20 '14 at 12:06lstinputlisting
to include latex code with sectioning commands. Besides that all work fine, as far as I know. – Smarzaro Nov 21 '14 at 2:34