How can I evaluate Ruby code on-the-fly when you are writing it?
This is what it looks like:
5 + 5 # => 10
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
If you want to evaluate a single line you can do this with a macro simply :
qq$hy:r! ruby -e '<C-r>"'<CR>
qq " record a new macro v$hy " select the current line minus the ^m :r! " prepare to read a command ruby -e '<C-r>"' " call ruby inline mode executing <CR> " execute the whole thing
You now have the result on the new line, feel free to customize :)