Snippets allow you to store frequently used pieces of text for reuse. They can be made somewhat dynamic via the use of variables, and can be triggered by key combinations or by keyword expansion. Keyword expansions are triggered when you type the keyword and hit tab or return. Snippets can be edited and accessed via the Snippets menu.
Snippets are text files, so editing Snippets is simply a matter of opening the Snippets directory as a project in skEdit. When you've made your changes, use the "Reload Snippets" item in the Snippets menu to make the menu adopt the changes. The Snippets menu will reflect the directory structure of the Snippets directory.
The Snippets Editor
To change the key combination and/or keyword expansion, edit a snippet. At the bottom of the editor, skEdit will present a user interface to edit these attributes. To set the keyword trigger, simply type it into the field. It should be one word without spaces. To set the key combination, select the field and hit the combination. If that combination is already being used, skEdit will not allow it to be assigned to the Snippet.
The key combination and keyword trigger are stored as comments at the top of the Snippet file as follows:
The key modifiers are mapped to normal characters. @ for Command, $ for Shift, ^ for Control, and ~ for Option.
Snippets can also contain variables that are evaluated when the Snippet is inserted. Three types of variables are supported: cursor, selection, and line. They can either be typed manually or inserted using the buttons in the Snippet editing interface.
A cursor variable is represented as
[*cur]. If present, the cursor will be placed at that location after the Snippet is inserted. If there are multiple cursor variables, you can then tab through them.
A selection variable is represented as
[*sel]. If present, will be replaced by the selection prior to inserting the Snippet.
The line variable can be used to apply some text around each line in the selection when the Snippet is inserted. It is represented by wrapping
[*<line>][*</line>] around the appropriate text. A selection variable can be embedded within a line variable. For example:
[*<line>]<li>[*sel]</li>[*</line>] could be used to wrap
<li></li> around each line in the selection.