Skip to content
The latest version of DbVisualizer was released 2024-08-30DOWNLOAD HERE ->

Using Editor Templates

Editor Templates can be used to easily insert text that you often use, such as code snippets, current date and time, or anything you like.

Only in DbVisualizer Pro

This feature is only available in the DbVisualizer Pro edition.

Using a Template

A template is an Abbreviation that can easily be replaced by its Expanded Text, and it may optionally have a Description.

To expand a template, just type a few characters that at least partially match one or more template abbreviation and press the TAB key. This displays a list of matching templates that you can pick from, along with the description or a part of the corresponding expanded text for each.

image2021 1 12 20 18 54

When you select a template by pressing the TAB or ENTER key, its expanded text replaces the abbreviation you typed in the editor.

image2021 1 12 20 20 43

You can also enable Instant Substitution to immediately expand the text if you have typed enough of the abbreviation to match a single template when you press the TAB key:

  1. Open Tools->Tool Properties,
  2. Select the General/SQL Commander/Editor Templates category,
  3. Click the Instant Substitution checkbox in the toolbar,
  4. Click the Apply or OK button to save the updated setting.

Instead of pressing the TAB key to list matching templates, you can use the Show Editor Templates entry in the main Edit menu or the editor right-click menu.

Creating a new Template

DbVisualizer comes with some default templates, but you can create additional templates:

  1. Open Tools->Tool Properties,
  2. Select the General/SQL Commander/Editor Templates category,
  3. Click the Insert button in the toolbar to add a new template, and enter an Abbreviation, Expanded Text, and optionally a Description,
  4. Check off the checkbox in the Format column if you want the Expanded Text to be formatted by the SQL Formatter when it is inserted in the editor,
  5. Click the Apply or OK button to save the new templates.

If you want to use an existing template as a starting point, you can select it and then click the Duplicate button instead of the Insert button. The Edit in Window button opens the selected cell in a separate window where it is easier to work with larger templates.

Always use a special character, such as dot or hashmark, as the first character in the Abbreviation. The default templates use a dot but you can pick any special character you like. If you use a regular character as the first character, unexpected matches may be found if one abbreviation starts with the same characters as another abbreviation ends with.

Editing or Deleting a Template

You can edit any piece of a template or delete templates you no longer need:

  1. Open Tools->Tool Properties,
  2. Select the General/SQL Commander/Editor Templates category,
  3. To edit, double-click any cell you want to change and edit its value,
  4. To delete a template, select any of its cells and click the Delete button,
  5. Click the Apply or OK button to save the changes.

Changing the Expand Keybinding

The keyboard shortcut used to expand a template, or bring up the list of matching templates if more than one, is the TAB key. You can add other shortcuts or change the default, as described in Changing Keyboard Shortcuts. The shortcut is named Show Editor Templates and you find it in the Main Menu/Edit category.