gEdit Template plugin
Monday, 19. November 2007, 17:14:40
For SweeTS i needed the possibilty to create a document based on a template file (the normal "New from template"). gEdit didn't ship with that and so i tried to create it. I was lucky to find a start in the familiar plugin by Rob Miller.
I heavily modified it and this is how it works:
* Copy the files of the Template plugin into ~/.gnome2/gedit/plugins
* create a folder "templates" in ~/.gnome2/gedit
* copy your templates files into it (example default.html)
* Start gEdit and enable the plugin "New File From a Template" in the preferences
* After a restart the plugin appears in the File menu
* Assign the typical shortcut "Shift+Ctrl+N" to it
* the new created files will get the mimetype of the template files
This is a first version and the code needs a small clean up but it works well.
Other gEdit plugins i wrote:
http://my.opera.com/area42/blog/gedit-language-reference-plugin
http://my.opera.com/area42/blog/gedit-browser-preview-plugin
A lot of other gEdit plugins can be found here.
I heavily modified it and this is how it works:
* Copy the files of the Template plugin into ~/.gnome2/gedit/plugins
* create a folder "templates" in ~/.gnome2/gedit
* copy your templates files into it (example default.html)
* Start gEdit and enable the plugin "New File From a Template" in the preferences
* After a restart the plugin appears in the File menu
* Assign the typical shortcut "Shift+Ctrl+N" to it
* the new created files will get the mimetype of the template files
This is a first version and the code needs a small clean up but it works well.
Other gEdit plugins i wrote:
http://my.opera.com/area42/blog/gedit-language-reference-plugin
http://my.opera.com/area42/blog/gedit-browser-preview-plugin
A lot of other gEdit plugins can be found here.
Great template! I've just released a basic template set for this: http://hansengel.wordpress.com/2007/11/27/gedit-template-plugin-basic-templates/
It includes most templates that web developers would need.
By anonymous user, # 28. November 2007, 04:02:42
very cool, i will check it out!
By area42, # 28. November 2007, 07:47:42
I have a suggestion for this plugin....
Why not make support for "variables", like the current user logged in? Then, we could reference the variables from our templates through brackets (ex. "{user}"). The plugin would process the template, and replace the variables with their values.
By anonymous user, # 28. November 2007, 13:37:10
By area42, # 28. November 2007, 18:10:45