Actually, as I discovered after posting, it's a lot easier to write a Compile() function that you get to control (like adding -Ilib) than depending on vim's make. So, I took that out. Plus, I found a few things better than BufNewFile and BufRead.

This is how my .exrc snippet looks now:

autocmd BufNewFile,BufRead *.p? so ~/.vim/perltest.vim autocmd BufEnter *.p? colors peachpuff autocmd BufNewFile,BufRead *.t so ~/.vim/perltest.vim autocmd BufEnter *.t colors blue

And, I make a few changes to my perltest.vim

" perltest.vim - test driven development for Perl with vim " " ,t -- Run tests " ,w -- Set current file as test file. Only this test will run. " ,W -- Unset current test file. All tests will run. " " Updates at function! Prove ( verbose ) if ! exists("g:testfile") let g:testfile = "t/" endif if g:testfile == "t/" || g:testfile =~ "\.t$" if a:verbose echo system("prove -vl " . g:testfile . " 2>&1 | tee " . & +errorfile) else echo system("prove -l " . g:testfile . " 2>&1 | tee " . &e +rrorfile) endif else call Compile () endif cfile endfunction function! Compile () if ! exists("g:compilefile") let g:compilefile = expand("%") endif execute "!perl -wc -Ilib " . g:compilefile cfile endfunction nmap ,t :call Prove (0)<cr> nmap ,T :call Prove (1)<cr> nmap ,v :call Compile ()<cr> nmap ,w :let g:testfile = expand("%")<cr>:echo "testfile is now" g:t +estfile<cr> nmap ,W :unlet g:testfile<cr>:echo "testfile undefined; will run all t +ests"<cr> " based on compiler/perl.vim by Christian J. Robinson <infynity@onewes> " added formats for test failures set errorformat= \%-G%.%#had\ compilation\ errors., \%-G%.%#syntax\ OK, \%+Anot\ ok\%.%#-\ %m, \%C%.%#\(%f\ at\ line\ %l\), \%m\ at\ %f\ line\ %l., \%+A%.%#\ at\ %f\ line\ %l\\,%.%#, \%+C%.%# " FIXME make this more local. Needed for redirection syntax which isn' +t csh compatible set sh=/bin/sh " Just more convenient when shelling out a lot. set autowrite

The main changes are:

I'm still figuring out the various parameters. Heck, I've learned more about the vim settings in the last hour than I had in the 10+ years I've been using vi-based editors! :-)

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

In reply to Re^3: Test driven development with Perl and vim by dragonchild
in thread Test driven development with Perl and vim by gaal

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.