Snippets

TEA Manual
Prev | Chapter 9. Functions | Next

# 9.10. Snippets

A snippet is the piece of code, which you can insert into the text. TEA keeps each snippet as a single file in $HOME/.tea/snippets directory. File name of a snippet is a menu item in Snippets-menu, i.e. the content of Snippets menu is the list of files from $HOME/.tea/snippets. To create a new snippet, you should do:

1. Write some text. 2. File > Save different > Save as snippet. UTF-8 only! 3. Enjoy :)

You can create a snippet that use a text selection in a some way. For example, you want to make a snippet which encloses the selected text into some HTML-tags. The %s macro represents a text selection. Here is the example of such snippet:

<a href="%s">%s</a>

When this snippet will be applied, %s will be replaced with a selected text. If there no text is selected, snippet content will be inserted into the text.

Prev | Home | Next
Scripts | Up | Tools