1. GtkSnippets
GtkSnippets is a library to manage snippets for all Gtk applications. We try to have an user database with all snippets and all application can use GtkSnippets to access to the same database. By example you can develop a gedit plugin using this library and an Anjuta plugin. The snippet database is the same for the user and he can use his snippets into gedit and anjuta.
Project homepage: https://sourceforge.net/projects/gtksnippets/
Screencast:
GtkSnippets Gedit plugin using inplace parser: http://gtksnippets.sourceforge.net/images/inplace-example.ogg
1.1. Internals
There are two libraries:
1.1.1. GSnippets
This library manage the database access. Internally uses sqlite3 in the user home.
This library have a parser to use simple wariables into the snippets content. By example we have this snippet content:
- class ${classname} extends Object{}
Then you can pass a variable classname=MyClass and the result will be:
class MyClass extends Object{}
You can use GtkSnippetsVarsDialog to easily replace the vars into the snippets content.
1.1.2. GtkSnippets
This library have various widgets to manage the snippets;
- gtksnippets-dialog: Dialog to add, modify, remove, etc.
- gtksnippets-varsdialog: Dialog to replace variables into the snippets content.
gtksnippets-inplaceparser: Replace variables into a GtkTextView directly "in place".
1.2. Snippets Completion
We have developed an Snippets provider for GtkSourceCompletion. This provider adds snippets support to GtkSourceCompletion. This provider adds a new page into the completion popup with the snippets for this language and you can select it and the snippets content will be added to the current text (or source code).
You can take a look at this screencast to see this in action.