Templates

Contents  Previous  Next

 

Menu: Tools > Templates

 

Default Shortcut Key: Ctrl+T

 

Macro function: Templates()

 

The Templates command is used to select a Template for insertion at the text cursor. Boxer's Templates are an excellent way to save and recall small pieces of text such as address blocks, copyright notices, programming language constructs, email addresses and any other text block which is used frequently during editing.

 

When the Insert Template command is issued, the Templates menu appears in a popup window:

 

ToolsTemplates

 

The active Template Set is displayed at the bottom of the window, and the Templates within that set are displayed in the main listing area.  Press the first letter of the Template name or cursor with the arrow keys to select the desired Template.  Press Enter (or double click with the mouse) to insert the selected Template into the file.

 

Right-clicking on a selected item summons the Template context menu.  The context menu provides options to insert the selected item, or to copy it to the current clipboard.

 

Template Sets and Templates are defined using the Configure | Templates command. 

 

Text Cursor Placement

The Vertical Rule character (|) can be placed within a Template to dictate where the text cursor should be placed within the Template following its insertion.  This allows, for example, programming code blocks to be defined in which the text cursor is placed between a pair of parentheses, ready for additional code to be typed.

 

Operating on Selected Text

The caret or circumflex character (^) can be placed within a Template to indicate that the template should operate on a text selection.  A pair of examples will help to illustrate the power of this feature:

 

Example 1:

The template <B>^</B>| would cause the current text selection to be surrounded with HTML bold tags.  The text cursor would be placed at the right of the closing bold tag.

 

Example 2:

The following Template:

 

<html>

<head>

|

</head>

<body>

^

</body>

</html>

 

could be run after using the Select All Text command to select the entire file.  The effect would be to add the required HTML tags that help make an ordinary text file ready for viewing on the Internet.  The text cursor would be place between the <head> and </head> tags, awaiting a title for the document.

 

Unindenting within a Template

If you need to unindent within a defined Template, use the tilde character (~) to designate the point at which the Backspace command should occur.  The tilde will not be recognized in this way unless the Insert as if typed from the keyboard option is in force (see Configure | Templates).

 

 

bm1If you need to insert one of the special characters (~, | or ^) into a template in its textual form, use either ~~, || or ^^.

 

bm2To ensure that special characters are displayed in the Template window as they will appear when inserted into the editor, the Template window uses the same font as is used in the editor itself.

 

bm1If the need arises to insert a single character which is not easily typed from the keyboard, consider using the Insert Symbols feature rather than defining a single character Template.  The Insert Symbols feature permits a defined character to be entered using a single keystroke.

 

bm1If the Template window is left on-screen when Boxer is closed, it will be automatically reopened if the edit session is later restored.