Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running ruby code from vim

Tags:

vim

ruby

Is it possible after editing a ruby program in Vim to run it while still in the editor, not using the command line?

like image 268
Sergey Avatar asked Aug 12 '11 15:08

Sergey


1 Answers

This is an old question but I wanted to tweak the answer by @xavier

Put this in your .vimrc and you will be able to run the current ruby script without having to confirm hitting ENTER each time:

autocmd BufRead, *.rb nmap <leader>r :silent !{ruby %}<cr>
like image 90
Tallboy Avatar answered Oct 05 '22 02:10

Tallboy