" Local configuration information for Perl filetypes " Set this once, globally. if !exists("perlpath") let perlpath = system('perl -e "print join(\",\",@INC)"') endif " "Perl help noremap K :!perldoc perldoc -f setlocal iskeyword+=: " Allow gf to work with modules set isfname+=: set include=\\<\\(use\\\|require\\)\\> set includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','') set path+=lib " check perl code with :make setlocal makeprg=perl\ -c\ -Iblib\ -Ilib\ %\ $* setlocal errorformat=%f:%l:%m setlocal errorformat+=%m\ at\ %f\ line\ %l. setlocal autowrite " Adds prove as the make option for .t files " ':make %' to run prove on the current file. Can pass more options to make. autocmd BufNewFile,BufRead *.t compiler perlprove " Tidy selected lines (or entire file) with ,pt nnoremap ,pt :%!perltidy -q vnoremap ,pt :!perltidy -q " Critic check the current file with ,pc nnoremap ,pc :!perlcritic % " Deparse obfuscated code with ,pd nnoremap ,pD :.!perl -MO=Deparse 2>/dev/null vnoremap ,pD :!perl -MO=Deparse 2>/dev/null "From Ovid noremap ,pd :!perldoc % " Prove test code nmap ,pp :!prove -blv % " Extend the snippets exec "source ".$HOME."/vim/after/ftplugin/perl_mysnippets.vim" autocmd BufNewFile *.pm 0r ~/.vim/templates/Module.pm autocmd BufNewFile *.pl 0r ~/.vim/templates/Program.pl autocmd BufNewFile *.t 0r ~/.vim/templates/Test.t " From Codon on PerlMonks " restore defaults (incase I :e or :sp) setlocal cinkeys& " don't go to column zero when # is the first thing on the line setlocal cinkeys-=0# " restore defaults setlocal cinwords& " add Perl-ish keywords setlocal cinwords+=elsif,foreach,sub,unless,until setlocal cinoptions& " I don't rememer these OTTOMH; :help cinoptions to learn more setlocal cinoptions+=+2s,(1s,u0,m1 setlocal cindent