Skip to content

@kana /hanekomu.vim
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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.