Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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
function! PerlReplacePackageName()
let package = PerlPackageNameFromFile()
let pos = getpos('.')
call setpos('.', pos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment