To avoid typing the same lines each time you open up a new file in vim, here is a little trick to do it. Let’s have a try with a simple perl template.
fool@localhost:~$ mkdir .vim
fool@localhost:.vim$cat > perl.template <<EOF
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
EOF
Now, in your vim’s configuration file :
fool@localhost:~$ cat >> .vimrc <<EOF
au BufNewFile *.pl 0r ~/.vim/perl.template
EOF
Anytime you create a new perl script with vim, you will find a few lines already it. Hope it helps !
Image may be NSFW.
Clik here to view.

Clik here to view.
