sponsor Vim development Vim logo Vim Book Ad

templator : Multi-file project templates using skeleton/snippets engines

 script karma  Rating 7/4, Downloaded by 2019  Comments, bugs, improvements  Vim wiki

created by
Tom Link
 
script type
utility
 
description
This plugin provides the |:Templator| command that can be used to easily
create multi-file projects.

In many programming languges/environments, you usually work with a set of files
that belong together. E.g. if you create a c file, you usually also want to
create a h header file. If you create a viewer file, you usually also want to
create corresponding model and controller files. If you want to create a
library file, you usually also want to create some test file etc. This is were
templator comes in.

The templator plugin allows the creation of filesets based on multi-file
templates. Possible use cases:

    - Create multi-file projects
    - Create multiple-files within a project, e.g.
        - a source file and the corresponding header file
        - a source file and the corresponding test file
        - files for a model, a view, and a controller

Templates can be written in any code template/skeleton/snippets style. At the
time of writing, templates can be written in:

    - template vim (see |templator-tvim|) ("tvim" extension)
    - tskeleton (vimscript #1160) ("tskel" extension)

It shoudln't be too difficult to add support for additional template
engines.


Tutorial~

The vimplugin template, which is provided with the plugin, consist of the following files: >

    ~/.vim/templator/vimplugin.tvim/README_${1}.TXT
    ~/.vim/templator/vimplugin.tvim/docs/${1}.txt
    ~/.vim/templator/vimplugin.tvim/plugin/${1}.vim
    ~/.vim/templator/vimplugin.tvim/autoload/${1}.vim

and an optional vim script (see |templator-scripts|) in:
    
    ~/.vim/templator/vimplugin.vim

The command call >

    :Templator ~/src/foo/bar/vimplugin myplugin

will result in the creation of the following files: >

    ~/src/foo/bar/README_myplugin.TXT
    ~/src/foo/bar/docs/myplugin.txt
    ~/src/foo/bar/plugin/myplugin.vim
    ~/src/foo/bar/autoload/myplugin.vim

Any placeholders within the files are expanded.
 
install details
In order to install the vba, open the vba file in VIM and type: >

    :so %

See :help vimball for details.

Also available via git: http://github.com/tomtom/templator_vim/


Optional enhancements:

In order to use tskeleton-style template sets, tskeleton (vimscript #1160) must
be installed: http://www.vim.org/scripts/script.php?script_id=1160

For projects under VCS control, if you want support for filenames relative to
the project's root, tlib (vimscript #1863) must be installed:
http://www.vim.org/scripts/script.php?script_id=1863
 

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
templator.vba 0.02 2013-05-21 7.0 Tom Link - tvim: Support end marker in strings
- Update r.tskel example template set
- Updated r.tskel
- g:templator#edit_again: The command used for editing files that already existed.
- r.tskel: tests/test_*.R: set  test_that context()
- Renamed g:templator#drivers to g:templator#hooks
- Enable place holders in directory names
- New hook: IncludeFilename: Check whether file should be created
- CheckArgs hook
- addon-info
- Moved r template set to rcom_vim
- Minor improvements
- tvim: Enable vimeval placeholders
- New vimplugin template set
- New vimfiletype template set
- vimfiletype, vimplugin: doc templates
MD5 checksum: fdf1ba7985f38db2a1c1d42f9a1f5459
templator.vba 0.1 2012-12-06 7.0 Tom Link Initial upload
ip used for rating: 142.132.191.50

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.
   
Vim at Github