Install vim-template vim plugin
The vim-template plugin allows for the use of templates for different file types: *.html, *.py and so on. Following the installation instructions (see above link), we use pathogen to install the plugin:
cd ~/.vim/bundle git clone git://github.com/aperezdc/vim-template.git
Use of plugin
Now, you can make use of the templates when starting vim. For example, a python template is loaded by recognition of the *.py filename:
Or, if you have new buffer, type the following for the template to be loaded inside vim:
The available templates can be seen here. Using the pathogen installation described above, these templates are located (on your machine) at
If you want to customize certain fields, like email and username, you can add the following to your .vimrc file:
" Customize the settings for vim-template plugin let g:email = "email@example.com" let g:user = "Desired Name" let g:license = "Desired License"
If you want to customize the templates, there is a search order for templates (see here) allowing you to write your own template-files and store them in the local directory.