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

G. Wade Johnson gwadej at anomaly.org
Sun Jan 15 08:40:52 PST 2017


On Sat, 14 Jan 2017 14:56:18 -0600
Julian Brown via Houston <houston at pm.org> wrote:

> Thanx Wade

Happy to spread it around. As I said at the meeting, I copied it fair
and square from someone else.<grin/>


> On Sat, Jan 14, 2017 at 10:43 AM, G. Wade Johnson via Houston <
> houston at pm.org> wrote:
> 
> > 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
> > _______________________________________________
> > Houston mailing list
> > Houston at pm.org
> > http://mail.pm.org/mailman/listinfo/houston
> > Website: http://houston.pm.org/
> >


-- 
Either a language matches the way you think or it doesn't.
                                                       -- Larry Wall


More information about the Houston mailing list