aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-04 11:08:55 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-04 11:08:55 +1200
commitcd28ccec63f7c1cb00b5f35aca6a8bff2a750581 (patch)
tree4d01583f7e057fc0a2e06d798592554f82b3ab18 /vim/autoload
parenta6b23888a58c2fb6cbc6ab7510772999f6c82b91 (diff)
downloaddotfiles-cd28ccec63f7c1cb00b5f35aca6a8bff2a750581.tar.gz
dotfiles-cd28ccec63f7c1cb00b5f35aca6a8bff2a750581.zip
Have Vim Perl major version bump map reset minor
Diffstat (limited to 'vim/autoload')
-rw-r--r--vim/autoload/perl.vim10
1 files changed, 5 insertions, 5 deletions
diff --git a/vim/autoload/perl.vim b/vim/autoload/perl.vim
index 5349eb49..a4c8724a 100644
--- a/vim/autoload/perl.vim
+++ b/vim/autoload/perl.vim
@@ -16,9 +16,10 @@ function! perl#BumpVersion(major) abort
let [l:lvalue, l:major, l:minor, l:rest]
\ = matchlist(getline(l:li), g:perl#verpat)[1:4]
if a:major
- let l:major = perl#Incf(l:major)
+ let l:major = perl#Setf(l:major, l:major + 1)
+ let l:minor = perl#Setf(l:minor, 0)
else
- let l:minor = perl#Incf(l:minor)
+ let l:minor = perl#Setf(l:minor, l:minor + 1)
endif
let l:version = l:major.'.'.l:minor
call setline(l:li, l:lvalue.l:version.l:rest)
@@ -39,7 +40,6 @@ function! perl#BumpVersionMajor() abort
endfunction
" Helper function to format a number without decreasing its digit count
-function! perl#Incf(num) abort
- let l:inc = a:num + 1
- return repeat('0', strlen(a:num) - strlen(l:inc)).l:inc
+function! perl#Setf(old, new) abort
+ return repeat('0', strlen(a:old) - strlen(a:new)).a:new
endfunction