Kate Snippets |
Prev | Working with Plugins | Next |
Kate Snippets is a plugin used to save you some time by adding support for so-called "snippets" (re-usable source code, machine code or text). The plugin also supports code completion and QtScript.
Shows snippets panel containing all snippets in your repository that are for the currently opened file type.
In the panel you should see a list of snippet repositories, along with options to create your own, get them from the Internet or load them from a local file. Each repository has a checkbox that can be used to activate or deactivate it. There are also buttons to edit and delete existing repositories.
You can download snippet repositories from the Internet. Just click and a window with a list of snippet repositories will open. After downloading the desired snippet, make sure that you have activated it.
You can also load snippet repositories from a local file using the file browser at the bottom of the panel. Click when finished.
To create a new snippet repository, click . You should now see dialog that asks for name of the snippet file, license and author. After choosing the desired options, click , and the snippet editor will open.
The snippet editor contains the following options:
Select the file type(s) you want the snippet repository to apply
to. It is set to “*” by default, so the repository applies to all files. You
can change it to something like C++
for instance, or select
from a list by hitting the . You can specify more
than one file type by separating them with ;
.
Enter the name(s) of the author(s) of the snippet file.
Contains all snippets defined in the snippet file. You can simply click on a snippet listed there to edit it.
Used to add a new snippet.
Used to delete a snippet.
Appears in the list of snippets in the tool view and is also searched when using the code completion feature.
Used to display helpful information while using code completion. The prefix and postfix are displayed before and after the name, while the arguments are displayed in parenthesis immediately after the name.
Reusable text or code. This is what appears in your document when the snippet is used.
In Snippet Content you can specify variables with
${
or
name
}%{
. These can be filled
by QtScript or when the snippet is used. There is a special variable -
${cursor} or %{cursor} - which automatically sets the cursor to its first
occurrence.name
}
You can call snippets in two ways:
By choosing the snippet from the tool view.
While writing, you can press Ctrl+Space, which will display all the snippets in a convenient window from which you can choose from. You may enter the beginning of the snippets name before or after pressing this key combination, which provides functionality similar to code completion.
If the snippet contains variables (besides ${cursor}
)
the cursor will automatically go to the first occurrence of a variable and will
wait for you to write something. When you are done, you can press Tab to move
to the next variable, and so on.
Prev | Contents | Next |
Filesystem Browser | Up | Build Plugin |