Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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.

like image 288
cutalion Avatar asked Jan 20 '11 21:01

cutalion


1 Answers

Use xmpfilter from rcodetools.

like image 175
ephemient Avatar answered Oct 02 '22 07:10

ephemient