Using Text Commands

You can use Text Commands to control different aspects of the expanded template. You can use Text Commands for the following tasks:

Clipboard Contents

Use the «Paste» text command to insert the clipboard contents at the specified position. You can add the corresponding text command using the first Template Editor's toolbar button.

Ext_Template_Paste

For example, if the clipboard contains the "192.168.1.15" string, this template expands as follows:

SqlConnection sqlConnection = new SqlConnection();
sqlConnection.ConnectionString = "Data Source=192.168.1.15; User id=; Password=;";
sqlConnection.Open();
try {

}
finally {
    sqlConnection.Close();
}
Note

If you need to change the template expansion for situations when the clipboard contains no proper data, create an alternative expansion and add a context restriction to the base one. The template containing the «Paste» text command should restrict expansion when the clipboard does not contain proper data.

Caret Position

Use the «Caret» text command to put the caret at a specified position after the template expansion. You can insert the text command which marks the caret position with the second Template Editor toolbar button.

Ext_Templates_Caret

This template expands with the caret placed at the specified position, as shown below.

SqlConnection sqlConnection = new SqlConnection();
sqlConnection.ConnectionString = "Data Source=localhost; User id=; Password=;";
sqlConnection.Open();
try {
}
finally {
    sqlConnection.Close();
}

Selection

You can use two text commands — «Caret» and «BlockAnchor» — to select a part of your template after expansion. The text between these text commands is selected after expansion, and the caret is placed at the «Caret» text command's position. You can insert the «Caret» and «BlockAnchor» text commands using the second and third Template Editor toolbar buttons.

Ext_Templates_Block

After expansion, this template contains the selected text block.

Ext_Templates_Block_Result_GIF

Markers

Note

To enable this feature, use the Enable Markers checkbox on the Editor | All languages | Markers options page.

Use markers to label important positions in your template and jump to them after expansion with a single keystroke. You can drop markers at the required positions and collect them after the expansion. To insert the «Marker» text command, click the fourth Template Editor toolbar button.

Ext_Templates_Marker

After expansion, this template contains two markers, which can be sequentially collected using the Esc key.

Ext_Templates_Marker_Result_GIF

Note

If you are not sure that the marker is required, you can specify its lifetime. This deletes the marker if it is not collected after a certain period. You can pass the lifetime in seconds as a parameter to the «Marker» text command. For instance, the marker declared as «Marker(10)» is removed in ten seconds after the template expansion.

Expand Another Template

You can expand a template inside another template expansion. To insert the corresponding Text Command, right-click the template editor area and choose the Insert Alias... item from context menu.

Select the required template in the invoked editor and click OK.

This inserts the text command that expands the selected template inside your template.