" add mapping for insert-mode completion (looks up keyword in dictionary) imap " list files in current directory. map ,ls :!ls "Inserting date and Updates iab YDATE =strftime("%A %d %b %Y %H:%M") map ,L 1G/Last update:\s*/e+1CYDATE map ,,L 1G/Last change:\s*/e+1CYDATE "Resize windows map :resize +2 map :resize -2 " Jumping to function with tags "nmap ?[^a-zA-z0-9_]lvt( "nmap :pop " deleting those fecking ^M map :%s/^M//g^M map :!bash^M map :q!^M map :w^M " replace bunch of WS with one blank Ctrl-x nmap ^X dwi ^[ " Commenting a whole paragraph with # style comments " pcp = Perl Comment Paragraph map ,pcp vip:s%^%# % vmap ,pcp :s%^%# % " Removing the # comment of a commented paragraph " rpc = Remove Perl Comment map ,rpc vip:s%^# %% vmap ,rpc :s%^# %% " F2 close current window (commonly used with my F1/F3 functions) noremap :close " 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 \" 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=2 set shiftwidth=2 set cindent set comments=:# set formatoptions=croql set keywordprg=man\ -S\ 3 noremap :call PerlCW() noremap :call PerlOutput() endfunction if has("eval") augroup SetEditOpts au! " Perl autocmds autocmd BufNewFile *.pl,*.cgi 0r ~/vim/skeletons/skel.pl autocmd BufWrite *.pl,*.cgi !chmod +x % autocmd FileType perl :call MyPerlSettings() augroup END endif