Skip to content

Instantly share code, notes, and snippets.

@moznion
Created November 3, 2019 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moznion/7325216f68298b6e8682605a59f7ee6d to your computer and use it in GitHub Desktop.
Save moznion/7325216f68298b6e8682605a59f7ee6d to your computer and use it in GitHub Desktop.
func! s:pm_template()
let path = substitute(expand('%'), '.*lib/', '', 'g')
let path = substitute(path, '[\\/]', '::', 'g')
let path = substitute(path, '\.pm$', '', 'g')
call append(0, 'package ' . path . ';')
call append(1, 'use strict;')
call append(2, 'use warnings;')
call append(3, 'use utf8;')
call append(4, '')
call append(5, '')
call append(6, '')
call append(7, '1;')
call append(8, '')
call append(9, '__END__')
call append(10, '')
call append(11, '=encoding utf8')
call append(12, '')
call append(13, '=head1 NAME')
call append(14, '')
call append(15, path . ' - ')
call append(16, '')
call append(17, '=cut')
call cursor(6, 0)
endf
au PerlAutoCmd BufNewFile *.pm call s:pm_template()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment