.vimrc options to assist with perl coding
Sunday, January 16th, 2005Edit the .vimrc file and add the following:
” F2 close current window (commonly used with my F1/F3 functions)
noremap
” perl -cw buffer, using a temp file, into a new window
function! PerlCW()
let l:tmpfile1 = tempname()
let l:tmpfile2 = tempname()
execute “normal:w!” . l:tmpfile1 . “\
execute “normal:! perl -cw “.l:tmpfile1.” \> “.l:tmpfile2.” 2\>\&1
+ \
execute “normal:new\
execute “normal:edit ” . l:tmpfile2 . “\
endfunction
” perl buffer, using a temp file, into a new window
function! PerlOutput()
let l:tmpfile1 = tempname()
let l:tmpfile2 = tempname()
execute “normal:w!” . l:tmpfile1 . “\
execute “normal:! perl “.l:tmpfile1.” \> “.l:tmpfile2.” 2\>\&1 \
+R>”
execute “normal:new\
execute “normal:edit ” . l:tmpfile2 . “\
endfunction
” Settings for editing perl source (plus bind the above two functions)
function! MyPerlSettings()
if !did_filetype()
set filetype=perl
endif
set textwidth=78
set expandtab
set tabstop=4
set shiftwidth=4
set cindent
set comments=:#
set formatoptions=croql
set keywordprg=man\ -S\ 3
noremap
noremap
endfunction
if has(”eval”)
augroup SetEditOpts
au!
autocmd FileType perl :call MyPerlSettings()
augroup END
endif
endif