-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME
58 lines (41 loc) · 2.35 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
In many programming languages/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 shouldn't be too difficult to add support for additional template
engines.
The |:Templator| command can be used to create multi-file projects.
Example 1: Create files for the "vimplugin" template-set in the current root
directory, which usually is the current working directory unless
|b:templator_root_dir| is set (see |templator-arguments| for details): >
:Templator vimplugin myplugin
"myplugin" is the plugin's name. The argument is required by the
template set used in this example. It is also possible to use named
arguments.
Example 2: Create files for the "vimplugin" template-set in some directory (the
directory is created if it doesn't already exist): >
:Templator ~/src/foo/bar/vimplugin myplugin
Templates are kept in "templator" subdirectories in your 'runtimepath' (e.g.
~/.vim/templator). A subdirectory's name consists of
"TEMPLATE_NAME.TEMPLATE_TYPE". TEMPLATE_NAME is the name that is used for the
|:Templator| command. TEMPLATE_TYPE is the name of the template engine used to
expand file templates.
Templates consist of a bunch of files and an optional vim script (see
|templator-scripts|) that is run after creating the files.
-----------------------------------------------------------------------
Status: Experimental
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.