This tiny VIM Skeletons plugin allows you to define a skeleton file per file type, which is used whenever you create a new file of that type. Furthermore, it makes use of UltiSnips snippet engine to directly leave you with placeholder you can jump through and prefill with sensible defaults.
For installation I recommend using Vundle, a package manager for VIM plugins.
If you have Vundle running, the following line in your .vimrc
enables the
plugin:
Bundle "tobyS/skeletons.vim"
Now you run
:BundleInstall
and you're done.
If you prefer any other VIM plugin manager, you will find your way according to your preferences. If you do not use a VIM plugin manager, you should use one.
I ship an example skeleton for your pleasure. Take a look in the skeletons/
directory. Note, that this skeleton will not be used by Skeletons by default.
Using Skeletons is easy. Just install the plugin and put your skeleton files into
~/.vim/skeletons/
a skeleton file name must follow the simple format whatever.<ft>
where
<ft>
is the file type you want to register the skeleton for. If you have
mutliple files for one type, Skeletons will simply use one. Which one? No idea.
Therefore I recommend to use skeleton.<ft>
by convention to avoid this
issue.
If you want to change the directory where skeletons are stored, take a look at Configuration.
You can influence the bahavior of Skeletons by two confiuguration variables:
g:skeletons_dir
- Set this variable to a different directory if you don't want to have your
skeletons to be located in
~/.vim/skeletons/
. g:skeletons_autoregister
- Set this to
1
in order to avoid Skeletons to auto-register its autocommand for inserting the skeletons. You need to do this action yourself then.