Feature Showcases
Snippets are frequently used strings that can be quickly inserted into the current document. For example, repetitive sections of code or standard comments can be stored within a snippet. Snippets have advanced properties; they support the use of Tabstops and Interpolation Shortcuts, can be assigned to Key Bindings, and allow for the specification of indentation context and cursor position.
Snippets are stored in the Projects sidebar or the Toolbox.
To create a code snippet, select the desired block of text in the Editor Pane. Then drag and drop the selected section onto the Toolbox tab or into a project on the Projects tab.
Alternatively, select the desired text, then right-click and select Add as Snippet in the Toolbox.
Alternatively, right-click a folder in the Toolbox or on a project or folder name in the Projects sidebar, and select New Snippet. If you use this method, you must manually enter the contents of the snippet; text selected in the Editor Pane is not automatically added to the Snippet dialog box.
To configure snippet properties, right-click the snippet on either the Toolbox tab or the Projects tab, and select Properties. The following configuration properties are available:
To insert the contents of a snippet at the current cursor position in the Editor Pane, double-click it, or right-click the snippet and select Insert Snippet.
Although you can also drag and drop snippets onto the Editor Pane, the cursor position and indentation check box options explained above in Configuring Snippets will only take effect if the snippet is added using the double-click or Insert Snippet method.
Snippets saved in a toolbox or project folder called "Abbreviations" (or a language-specific sub-directory) can be inserted by typing the snippet name in the buffer. See Abbreviations.
To access options for the selected snippet, do one of the following:
The following options are available:
libz
(for example WinZip). The Export
Package option differs from the Export as
Project File option in that copies of filesystem-based
components (such as files and dialog projects) are included in
the archive. Conversely, Export as Project
File creates a project with a reference to the
component's original location and does not create copies of the
components. When Export Package is invoked,
you are prompted for a name and file location for the package.
Exported packages can only be imported into "container" objects
in Komodo, such as projects, the Toolbox, and folders within
projects and the Toolbox. See Toolbox - Exporting and
Importing Toolbox Contents, Projects - Importing
and Exporting Projects via Packages, or Folders - Import
Contents from Package for more information.Snippet properties are used to alter or rename snippets (as described in Configuring Snippets, above). The Properties dialog box is also used to assign a custom icon to a snippet or to assign a custom key binding. To access the Properties dialog box, right-click the snippet and select Properties.
The default snippet icons can be replaced with custom icons. Komodo includes more than 600 icons; alternatively, select a custom image stored on a local or network drive (use 16x16-pixel images for best results).
To assign a custom icon to a snippet:
To revert to the default icon for a selected snippet:
To assign a key binding to a snippet, right-click the snippet on either the Toolbox tab or the Projects tab, and select Properties. Select the Key Bindings tab, and configure the desired binding. See Key Bindings for Custom Components for more information.
See Abbreviations for details on inserting snippets by name.