Efficient way to run Ruby in Vim | Sololearn: Learn to code for FREE!

+4

Efficient way to run Ruby in Vim

So with Python's default IDE, you can just press F5 to run your code. When I'm writing Ruby with Vim if I want to run it. I have to exit Vim, type ruby "filename.rb", then reopen vim. Isn't their any better way that I can do this? So I don't have to exit and reopen Vim all the time? Like how I can type :w to write, can I type :run to run? Thanks in advanced.

6/28/2018 5:22:30 PM

Canada

4 Answers

New Answer

+2

first of all you must type :w to save then type :! ruby 'filename' to run

+1

You could run the file you're editing with :!ruby % % represents the name of current file