Vim and make

We’re having a bit of a discussion over on vim-ruby-devel about the
appropriate default ‘makeprg’ setting for the rubyunit compiler plugin.

I’m curious how many people use the make utility to run their Test::Unit
tests. More generally, how do vim users currently run unit tests?

Thanks,
Doug

I have the following targets in the Makefile for Borges:

syntax: # checks syntax
test: syntax # runs unit tests
webtest: test # launches a test application
objectbrowser: syntax # launches an ObjectSpace browser app
sushi: syntax # launches SushiNet
doc: syntax # creates rdoc
install: test # installs
clean: # remove RDoc and setup.rb files

Despite all these targets, I rarely run make test from vim. When
running the test suite with -dw, vim typically jumps to the wrong file,
and I’m so used to switching between different screens that I rarely
even think about using vim’s make features.

···

Doug Kearns (djkea2@mugca.its.monash.edu.au) wrote:

We’re having a bit of a discussion over on vim-ruby-devel about the
appropriate default ‘makeprg’ setting for the rubyunit compiler plugin.

I’m curious how many people use the make utility to run their Test::Unit
tests. More generally, how do vim users currently run unit tests?


Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Doug Kearns wrote:

We’re having a bit of a discussion over on vim-ruby-devel about the
appropriate default ‘makeprg’ setting for the rubyunit compiler plugin.

I’m curious how many people use the make utility to run their Test::Unit
tests. More generally, how do vim users currently run unit tests?

Thanks,
Doug

Your post sparked some interest. I have been using vim for a while but
my level of understanding is pretty much limited to basic text file
editing. I have been wanting to raise the bar and become a more serious
vim guru. Are you saying that vim has a mechanism for compiling within
vim and running automated tests/debugging etc.? I know that you can
execute arbitrary shell commands, but are you saying that there is a
more custom-tailored plugin for doing things like this? And finally,
what would be a good book and/or web site that you could recommend to me
for learning how to use these features?

Thanks,
Carl

I’m curious how many people use the make utility to run their Test::Unit
tests. More generally, how do vim users currently run unit tests?

Your post sparked some interest. I have been using vim for a while but
my level of understanding is pretty much limited to basic text file
editing. I have been wanting to raise the bar and become a more serious
vim guru. Are you saying that vim has a mechanism for compiling within
vim and running automated tests/debugging etc.? I know that you can
execute arbitrary shell commands, but are you saying that there is a
more custom-tailored plugin for doing things like this? And finally,
what would be a good book and/or web site that you could recommend to me
for learning how to use these features?

Yep, do a “:help make” or “:help makeprg”. As far as recommending books
or web sites, I’d simply recommend the Vim online help system (:help).
You can read it right inside Vim itself, and I’ve found that it’s very
thorough and useful. I’ve learned most of what I know about Vim from
reading the help pages.

– Mike

···


Michael W. Thelen
Perfection is achieved, not when there is nothing left to add, but when there
is nothing left to take away.
– Antoine de St. Exupery, “Wind, Sand, and Stars”, 1939

Quoteing drbrain@segment7.net, on Wed, May 05, 2004 at 10:23:44PM -0700:

···

Doug Kearns (djkea2@mugca.its.monash.edu.au) wrote:

We’re having a bit of a discussion over on vim-ruby-devel about the
appropriate default ‘makeprg’ setting for the rubyunit compiler plugin.

I’m curious how many people use the make utility to run their Test::Unit
tests. More generally, how do vim users currently run unit tests?

Despite all these targets, I rarely run make test from vim. When
running the test suite with -dw, vim typically jumps to the wrong file,
and I’m so used to switching between different screens that I rarely
even think about using vim’s make features.

The make features are pretty cool for running unit tests… but only
when they actually jump you to the right line!

Given that vim doesn’t, I run my unit tests in another window, now, too.

Sam

Quoteing carl@youngbloods.org, on Fri, May 07, 2004 at 01:28:02AM +0900:

Your post sparked some interest. I have been using vim for a while but
my level of understanding is pretty much limited to basic text file
editing. I have been wanting to raise the bar and become a more serious
vim guru. Are you saying that vim has a mechanism for compiling within
vim and running automated tests/debugging etc.? I know that you can

In general it's easy, write a Makefile:

--- Makefile ---

default: test

test:
  ruby -w -I. my_test.rb

···

----------------

Then, from inside vim, do ":mak".

Cheers,
Sam

–8vCeF2GUdMpe9ZbK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I’m curious how many people use the make utility to run their Test::Unit
tests. More generally, how do vim users currently run unit tests?

Your post sparked some interest. I have been using vim for a while but=
=20
my level of understanding is pretty much limited to basic text file=20
editing. I have been wanting to raise the bar and become a more serious=
=20
vim guru. Are you saying that vim has a mechanism for compiling within=
=20
vim and running automated tests/debugging etc.? I know that you can=20
execute arbitrary shell commands, but are you saying that there is a=20
more custom-tailored plugin for doing things like this? And finally,=20
what would be a good book and/or web site that you could recommend to me=
=20
for learning how to use these features?

Yep, do a “:help make” or “:help makeprg”. As far as recommending books
or web sites, I’d simply recommend the Vim online help system (:help).
You can read it right inside Vim itself, and I’ve found that it’s very
thorough and useful. I’ve learned most of what I know about Vim from
reading the help pages.

To get you started, the following might be nice to have in your
~/.vimrc:

"---------------------------------------
“Current dir == File dir
“Set vims working directory to the directory of the currently open file.
function! CHANGE_CURR_DIR()
let _dir = expand(”%:p:h”)
exec "cd " . _dir
unlet _dir
endfunction

autocmd BufEnter * call CHANGE_CURR_DIR()

"Ruby stuff
autocmd BufEnter .rb set makeprg=ruby\ -w\ $\ %
autocmd BufEnter .rb set efm=%+E%f:%l:\ parse\ error,%W%f:%l:\ warning:\ %m,%E%f:%l:in\ %[^:]:\ %m,%E%f:%l:\ %m,%-C%\tfrom\ %f:%l:in\ %.%#,%-Z%\tfrom\ %f:%l,%-Z%p^,%-G%.%#
"----------------------------------------

Anyone else have any vim+ruby related stuff to share?

//Anders

···


/**

  • Anders Engström, aengstrom@gnejs.net

  • Your mind is like an umbrella.
  • It doesn’t work unless you open it.
  • /Frank Zappa
    */