[pm-h] One-line filetype template system in vim

G. Wade Johnson gwadej at anomaly.org
Sat Jan 14 08:43:21 PST 2017


In part of my talk on Thursday, I showed how I do filetype templates in
vim. Several people asked for a copy.

Add the following line in your .vimrc

  autocmd BufNewFile * silent!    0r ~/.vim/templates/%:e.template

and create the directory ~/.vim/templates.

When creating a new file, this will cause vim to look in the template
directory for a file named {file_extension}.template and load it first.

Here's my template pl.template
-------------------
#!/usr/bin/env perl

use strict;
use warnings;
use 5.010;

-------------------

Have more vim fun.
G. Wade
-- 
A product's only late once, but it can suck forever.
                                     -- Ben Spees, Ambrosia Software


More information about the Houston mailing list