vim file templates (aka skeletons) using Mako template engine
Install to ~/.vim/plugins/
or if using pathogen
git clone https://github.com/jabbas/vimplates bundle/vimplates
Default templates directory is .vim/templates
or (if you use pathogen) .vim/bundle/vimplates/templates
you can change it by adding this line to your .vimrc
:
let g:vimplates_templates_dirs = ['/path/to/templates', '/another/path/to/templates']
You can configure some special variables which will be used in templates:
g:vimplates_username
(default:"John Doe"
),g:vimplates_email
(default:"[email protected]"
),g:vimplates_website
(default:"http://nothing.com"
),g:vimplates_license
(default:"GPL-3"
)
By default vimplates uses filetype set by vim as a name of the template, so for python it uses python
, for perl perl
etc...
There are some special variables you can use in the templates:
username
will put contents ofg:vimplates_username
,email
will put contents ofg:vimplates_email
,website
will put contents ofg:vimplates_website
,vars
is an container for:vars.filename
- filename of the file you opened in current vim buffer,vars.filetype
- file type set by vim,vars.cwd
- current working directory,- ... and will be more in the future
vim
a reference to vim module (see:help python-vim
or vimdoc.sf.net)
Basically, Mako uses python inside templates. See Mako Documentation and/or templates
directory for examples.
- improve cursor position (it's ugly and does not work in some cases)
- loadable per file,
- moar templates/examples