Search code examples
rubyvimpluginstextmate

"Execute and Update '# =>' Markers" for VIM


Is there a possibility in VIM to repeat "Execute and Update '# =>' Markers" TextMate feature for ruby code.

I'd like to have something like:

x = 2
class A
  def a
    42
  end
end

x # => 
A.new.a # =>

Enter some command... and get

x = 2
class A
  def a
    42
  end
end

x # => 2
A.new.a # => 42

Here is a description of this feature from Ciarán Walsh’s Blog:

Another tool definitely worth knowing is the "Execute and Update '# =>' Markers" command (on ⌃⇧⌘E by default). To use it, add some comment markers (there is a snippet on #⇥ that will insert these for you) to the end of lines you would like to see the results of and then trigger the command. TextMate will run your code and report the result of the marked line inline in the comments. This feature is great for code posted online since it shows the source and the results together.


Solution

  • Use xmpfilter from rcodetools.