vimenv

configure vim environment
git clone git://git.unixkoans.com/vimenv.git
Log | Files | Refs | Submodules

perl.vim (947B)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"
" author:    Xu Xiaodong <[email protected]> 
" modified:  2016 Dec 04
"

"-- perl --"

let perl_include_pod=1
let perl_extended_vars=1
let perl_sync_dist=250

nmap <leader>p :call _set_sh_header()<cr>
nmap <leader>us :<c-u>call _perl_use()<cr>

" comment
nmap _c :call _perl_comment()<cr>
vmap _c :call _perl_comment()<cr>

" tidy selected lines (or entire file) with _t:
nmap <silent> _t :%!perltidy -q<cr>
vmap <silent> _t :!perltidy -q<cr>

" check perl code with :make
autocmd FileType perl set makeprg=perl\ -c\ %\ $*
autocmd FileType perl set errorformat=%f:%l:%m
autocmd Filetype perl set equalprg=perltidy
autocmd FileType perl set autowrite

" pressing K while on a keyword will bring up perldoc
autocmd FileType perl :nmap K :!perldoc <cword> <bar><bar> perldoc -f <cword><cr>

" perl file header
autocmd BufNewFile *.pl call _set_sh_header()

" compile check
autocmd! FileType perl :nmap <leader>c :!time perl -MVi::QuickFix -c %<cr>