Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View hanekomu.vim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
nnoremap <Leader>pa :<C-u>call PerlReplacePackageName()<CR>
 
function! PerlPackageNameFromFile()
let filename = expand('%:p')
let package = substitute(filename, '^.*/lib/', '', '')
let package = substitute(package, '\.pm$', '', '')
let package = substitute(package, '/', '::', 'g')
return package
endfunction
 
function! PerlReplacePackageName()
let package = PerlPackageNameFromFile()
let pos = getpos('.')
1,/^package\s/s/^package\s\+\zs[A-Za-z_0-9:]\+\ze\(\s\+{\|;\)/\=package/
call setpos('.', pos)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.