|
Tab Stop/Replace markers ("«»") are used in snippets and templates as placeholders for
inserting content. They change the behavior of the Tab key when they are
present.
The markers have the following format in a snippet or template:
[[%tabstop:name]]
When the snippet is used or a new file is created from the
template, the marker looks like this:
«name»
The "name" between the chevron characters ("«" and
"»") is the default value of the marker. It can be set to any
string (see examples below).
After the snippet is inserted, the first marker is selected. The marker can
be replaced with text at this point, or left as the default value. Use the
Tab key to replace the marker and all subsequent markers with
the same name with the new text or default value. Use the Tab
key again to jump to the next marker.
Here's an example of a "blank" PHP function snippet that uses
Tab Stop/Replace markers:
/*
* function «name»
* @param $«arg»
*/
function «name»($«arg») {
«»
}
The «name» marker is the first place "Tab" will stop. It gets
replaced with the function name which is propagated through the
rest of the snippet when "Tab" is hit again. The «arg» marker is
the next place "Tab" stops, and is treated the same way.
It is useful to leave the cursor in the snippet window
immediately before the first Tab Stop/Replace marker and select
Maintain selected text or cursor position after
insertion. If the cursor is left at the end of the
snippet, "Tab" will not encounter the markers.
Here's another example of a short snippet for HTML:
<«div»>[[%s]]</«div»>
The current selection is wrapped in an element (a "div" by
default). Hitting "Tab" after insertion will select the first
"div" for replacement. If it is replaced, the closing tag will be
changed when "Tab" is hit again. If it is not replaced, "div"
will be used as the element type.
|