sponsor Vim development Vim logo Vim Book Ad

templateX : An advanced templating system

 script karma  Rating 6/3, Downloaded by 2563  Comments, bugs, improvements  Vim wiki

created by
Michael Arlt
script type
This is a plugin for Vim that will allow you to have a set of                                                                                                    
templates for certain file types. It is useful for automating
some daily tasks with custom includes which enable you to
extend the functionality of templateX.

Its features makes it worth having more than only one look:

  + Traverses templates folder during search for a template
  + Uses templates with exact filename, *.extension or *
  + Files with '%' are treated in a special way: etc%test as /etc/test
  + User can select template variants - e.g. *.sh,shebang *.sh,shortopts
  + Standard variables from the plugin are available
  + Extensibe with custom include files (.vim) and templates
  + Facts from facter (live or from file) can be available as template variables
  + Functions as interface to logging and template variables
  + Templates and includes are maintainable outside of plugin directory (central)
  + Large set of example templates (bash, completion, ruby, perl, icinga, puppet)

Please provide feedback (Wiki/Mail) - especially if you vote "Unfulfilling".

Here is a list of all files ("templateX/" at the beginning is removed) to get a better impression:

# type filename
d plugin/
- plugin/templateX.vim
d templates/
- templates/*.sh,shebang
- templates/*.sh,yad-monitor_foreground_process
- templates/*.sh,shortopts
d templates/etc/
d templates/etc/icinga/
d templates/etc/icinga/objects/
- templates/etc/icinga/objects/*.cfg.templateX.vim
d templates/etc/icinga/objects/windows/
- templates/etc/icinga/objects/windows/*.cfg
d templates/etc/icinga/objects/linux/
- templates/etc/icinga/objects/linux/*.cfg
d templates/etc/bash_completion.d/
- templates/etc/bash_completion.d/*
d templates/etc/puppet/
d templates/etc/puppet/modules/
d templates/etc/puppet/modules/*/
d templates/etc/puppet/modules/*/manifests/
l templates/etc/puppet/modules/*/manifests/*.pp,complete -> init.pp,complete
- templates/etc/puppet/modules/*/manifests/init.pp,complete
- templates/etc/puppet/modules/*/manifests/params.pp
- templates/etc/puppet/modules/*/manifests/init.pp,simple
- templates/etc/puppet/modules/*/manifests/*.pp.templateX.vim
- templates/etc/puppet/modules/*/manifests/install.pp
l templates/etc/puppet/modules/*/manifests/* -> .
- templates/etc/puppet/modules/*/manifests/service.pp
l templates/etc/puppet/modules/*/manifests/*.pp,simple -> init.pp,simple
- templates/etc/puppet/modules/*/manifests/config.pp
- templates/etc/puppet/modules/*/manifests/init.pp,separate
d templates/etc/puppet/modules/*/files/
d templates/etc/puppet/modules/*/files/etc/
l templates/etc/puppet/modules/*/files/etc/bash_completion.d -> ../../../../../bash_completion.d
d templates/etc/puppet/modules/*/tests/
- templates/etc/puppet/modules/*/tests/init.pp
l templates/etc/puppet/modules/*/tests/*.pp.templateX.vim -> ../manifests/*.pp.templateX.vim
- templates/etc/puppet/modules/*/tests/*.pp
d templates/etc/puppet/modules/*/lib/
d templates/etc/puppet/modules/*/lib/facter/
- templates/etc/puppet/modules/*/lib/facter/*.rb
- templates/etc/puppet/modules/*/lib/facter/*.templateX.vim
d templates/etc/puppet/modules/*/lib/puppet/
d templates/etc/puppet/modules/*/lib/puppet/parser/
d templates/etc/puppet/modules/*/lib/puppet/parser/functions/
- templates/etc/puppet/modules/*/lib/puppet/parser/functions/*.rb
- templates/etc/puppet/modules/*/lib/puppet/parser/functions/*.templateX.vim
- templates/*.sh,yad-simple
- templates/*.sh,longopts
- templates/*.sh,yad-status_from_called
- templates/*.sh,yad-monitor_background_process
d templates/home/
d templates/home/*/
d templates/home/*/.vim/
d templates/home/*/.vim/bundle/
d templates/home/*/.vim/bundle/templateX/
d templates/home/*/.vim/bundle/templateX/templates/
- templates/home/*/.vim/bundle/templateX/templates/*
- templates/home/*/.vim/bundle/templateX/templates/*.vim
l templates/home/*/.bash_completion.d -> ../../etc/bash_completion.d
- templates/*.rb
- templates/*.pl
- templates/*.templateX.vim
d doc/
- doc/templateX.txt
- doc/tags
- README.rst
install details
Installation is simple. If using Pathogen: unpack to ~/.vim/bundle/templateX.
Examine and customize the templates - use it.
For advanced configuration see README.rst.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
templateX.tar.gz 1.14 2013-06-11 7.0 Michael Arlt - Small bugfixes/improvements in templates (especially YAD)
- Additional YAD template
- Renamed some templates                                                  
- Cleanup of tabs/spaces in Vim- and Puppet-templates
templateX.tar.gz 1.13 2013-05-17 7.0 Michael Arlt - Improved & shortened logging
- Abort if user selects no template variant
### no further ideas for improvement - your ideas are welcomed ###
templateX.tar.gz 1.12 2013-05-14 7.0 Michael Arlt - Small improvements (no bugfixes)
  - Logging for :TemplateXlog
  - doc/templateX.txt
templateX.tar.gz 1.11 2013-05-13 7.0 Michael Arlt - YAD templates extended
- Bugfixes/small improvements in templates (completion, bash*getopt*, yad)
templateX.tar.gz 1.1 2013-05-11 7.0 Michael Arlt - New feature: Treat ``vi etc%test`` as vi /etc/test
- New feature: User can select template variants
- Reduced standard output to one line (no return needed)
- Puppet templates (Designed für Puppet 2.7 (Ubuntu 12.04))
  - Design adjusted to `Modern Module Development from Ken Barber`__
  - Variant example for manifests/init.pp
  - Moved modules templates in order to match puppet default location
  - Subclasses can be in subfolders
- Variant examples for Shellscripts (``*.sh``)
  - longopts (uses getopt)
  - shortopts (uses getopts)
  - simple (shebang only)
  - yad-frontend (frontend for scripts using yad - yet another dialog)
- Completion template
- Bugfixes in README.rst
- Some smaller code improvements
templateX.tar.gz 1.01 2013-04-20 7.0 Michael Arlt - Fixed case sensitivity (s/.../.../gI) for tag replacement
- Added message if factsfile missing/access
- Use echoe for error messages
- Small changes in templates
templateX.tar.gz 1.0 2013-04-09 7.0 Michael Arlt Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.