Skip to content

Instantly share code, notes, and snippets.

@karthikselva
Created March 14, 2013 11:34
Show Gist options
  • Select an option

  • Save karthikselva/5160673 to your computer and use it in GitHub Desktop.

Select an option

Save karthikselva/5160673 to your computer and use it in GitHub Desktop.
Whenever I need to run ruby from VIM I used to exit and run the script and load back VIM. ( Bad ) Then learned to use **:!ruby** which would execute the supplied command in shell and return back. ( Better ) But the below gist would help you run with press of F6 key.
" Save the current file and run current ruby script
function! RunRuby()
:w
let name = input('Enter Argument (if any): ')
execute ':!ruby % '.name
endfunc
" Use F6 to trigger a run
map <F6> :call RunRuby()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment