views:

121

answers:

2

Hi,

I started using vim for my programming projects (mostly Ruby) and mostly everything works just as I want but I have a problem with compiling.

Lets say I am working on a Ruby script and I want to run it. I type :ruby sometging.rb (mapped to some other key). Then vim opens a new cmd.exe window and runs 'ruby something.rb'. Then it waits for me to press ENTER to close the window and continue working on the script.

Is there a way to configure vim on windows so that it always runs the script I'm working on in a separete window (always the same one, if none exists => open one), and not ask me to confirm with enter?

A: 

Don't know about gvim, but in normal vim you could put something like

map R <ESC>:tabnew<CR><ESC>:;%!ruby filename.rb<CR>

in your ~/.vimrc which would execute a Ruby file in a newtab when pressing R in command mode.

Dan Beam
A: 

I've not used Ruby, but for I've found Dr Chip's RunView plugin really useful for running other interpreted languages.

Once it's installed, you can enter:

:RunView! <interpreter>

(where <interpreter> is presumably 'ruby' in your case) and it will open a (vertically if you include the !) split window with the output from passing the contents of the current window to the interpreter. Each time it is run, a new result log is appended to the end of the file (with a date and time stamp separating them).

If you have any issues with it, I'd recommend you contact Dr Chip via the Vim mailing list: he's very helpful (in fact he wrote the original version of RunView in response to a request I made on the mailing list).

Al