diff options
Diffstat (limited to 'vim/autoload/perl.vim')
-rw-r--r-- | vim/autoload/perl.vim | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/vim/autoload/perl.vim b/vim/autoload/perl.vim index 3b87bb36..7d825604 100644 --- a/vim/autoload/perl.vim +++ b/vim/autoload/perl.vim @@ -2,26 +2,26 @@ function! perl#Boilerplate() abort " Flag whether the buffer started blank - let l:blank = line2byte(line('$') + 1) <= 2 + let blank = line2byte(line('$') + 1) <= 2 " This is a .pm file, guess its package name from path if expand('%:e') ==# 'pm' - let l:match = matchlist(expand('%:p'), '.*/lib/\(.\+\).pm$') - if len(l:match) - let l:package = substitute(l:match[1], '/', '::', 'g') + let match = matchlist(expand('%:p'), '.*/lib/\(.\+\).pm$') + if len(match) + let package = substitute(match[1], '/', '::', 'g') else - let l:package = expand('%:t:r') + let package = expand('%:t:r') endif " Otherwise, just use 'main' else - let l:package = 'main' + let package = 'main' endif " Lines always to add - let l:lines = [ - \ 'package '.l:package.';', + let lines = [ + \ 'package '.package.';', \ '', \ 'use strict;', \ 'use warnings;', @@ -34,24 +34,24 @@ function! perl#Boilerplate() abort \ ] " Conditional lines depending on package - if l:package ==# 'main' - let l:lines = ['#!perl'] + l:lines + if package ==# 'main' + let lines = ['#!perl'] + lines else - let l:lines = l:lines + ['', '1;'] + let lines = lines + ['', '1;'] endif " Add all the lines in the array - for l:line in l:lines - call append(line('.') - 1, l:line) + for line in lines + call append(line('.') - 1, line) endfor " If we started in a completely empty buffer, delete the current blank line - if l:blank + if blank delete endif " If we added a trailing '1' for a package, move the cursor up two lines - if l:package !=# 'main' + if package !=# 'main' -2 endif |