詩と創作・思索のひろば

ドキドキギュンギュンダイアリーです!!!

Fork me on GitHub

auto-insert package skeleton on a new .pm file

" .vimrc

augroup pm-autoinsert-package
    autocmd!
    autocmd BufNewFile *.pm call append(0, [
                    \ 'package ' . fnamemodify(expand('%'), ':r:s.^lib/..:gs./.::.') . ';',
                    \ 'use strict;', 'use warnings;'
                \ ])
                \ | call append(line('$'), '1;')
                \ | set modified
augroup END

https://github.com/motemen/dotfiles/blob/3887191/.vimrc#L558-566

はてなで一緒に働きませんか?