Search code examples
rubyvimtextmatesublimetext

Execute Code in VIM similar to Cmd+R in Textmate or Cmd+B Sublime Text2


Hey is there a way or plugin to execute Code e.g. Ruby in my case, directly from my vim editor. I know this from Textmate, where you can execute Code with Cmd+R or Cmd+B in Sublime Text2. In Sublime Text it is called Build System. Thanks for advise!


Solution

  • If you just want to execute the current buffer in Ruby, you could do this in normal mode:

    :!ruby %
    

    You could also map that to a shortcut with your leader key:

    :map <leader>r :!ruby %<cr>
    

    Which would let you do leader+r to run the file.