aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-04 13:08:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-04 13:08:30 +1200
commitd91e4c77ebe9a7dcc3336b25e0570551a933f974 (patch)
tree49d819767dd6517bf4059986de1ea5b094ce0a1a /vim/autoload
parentcd28ccec63f7c1cb00b5f35aca6a8bff2a750581 (diff)
downloaddotfiles-d91e4c77ebe9a7dcc3336b25e0570551a933f974.tar.gz
dotfiles-d91e4c77ebe9a7dcc3336b25e0570551a933f974.zip
Spin off Vim Perl version bump into ftplugin
Diffstat (limited to 'vim/autoload')
-rw-r--r--vim/autoload/perl.vim45
1 files changed, 0 insertions, 45 deletions
diff --git a/vim/autoload/perl.vim b/vim/autoload/perl.vim
deleted file mode 100644
index a4c8724a..00000000
--- a/vim/autoload/perl.vim
+++ /dev/null
@@ -1,45 +0,0 @@
-" Version number specifier format
-let g:perl#verpat = '\m\C^'
- \ . '\(our\s\+\$VERSION\s*=\D*\)'
- \ . '\(\d\+\)\.\(\d\+\)'
- \ . '\(.*\)'
-
-" Version number bumper
-function! perl#BumpVersion(major) abort
- let l:view = winsaveview()
- let l:li = search(g:perl#verpat)
- if !l:li
- echomsg 'No version number declaration found'
- return
- endif
- let l:matches = matchlist(getline(l:li), g:perl#verpat)
- 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#Setf(l:major, l:major + 1)
- let l:minor = perl#Setf(l:minor, 0)
- else
- 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)
- if a:major
- echomsg 'Bumped major $VERSION: '.l:version
- else
- echomsg 'Bumped minor $VERSION: '.l:version
- endif
- call winrestview(l:view)
-endfunction
-
-" Explanatory wrappers
-function! perl#BumpVersionMinor() abort
- call perl#BumpVersion(0)
-endfunction
-function! perl#BumpVersionMajor() abort
- call perl#BumpVersion(1)
-endfunction
-
-" Helper function to format a number without decreasing its digit count
-function! perl#Setf(old, new) abort
- return repeat('0', strlen(a:old) - strlen(a:new)).a:new
-endfunction