Evaluate your ruby code directly from VIM
When I am writing code, usually I want to evaluate some piece of code. I used to do the following actions:
- Copy and paste my code to IRB (or run my ruby script file directly from the terminal).
- When using
tmux, send my code directly from vim to tmux with the vim-tmux-runner plugin.
The first option needs an extra work of copying and pasting content. I prefer the second option, but sometimes I forgot to attach the VTR pane and get errors.
Now I’m using https://github.com/JoshCheek/seeing_is_believing along with https://github.com/t9md/vim-ruby-xmpfilter plugin
I set my
.vimrc with the following content (I use Plug to manage my dependencies):
Now I can visual select my code, use
mark and that line will be evaluated, press
F5 and get the result of that code. After, I can clean all marks with