21 Dec 09:07
Re: insert result of ruby
Tim Hammerquist <penryu <at> saiyix.ath.cx>
2005-12-21 08:07:34 GMT
2005-12-21 08:07:34 GMT
Tim Hammerquist wrote: > Jeff Rose wrote: > > Anyone know if there is a way to run a small bit of ruby and > > insert the result into the current buffer? > > > > I wanted to do something like this, but get the output into > > the buffer rather than the command window: > > > > :ruby require 'date'; puts Date.today > > Assuming you have a vim built with +ruby: > > :ruby <<EOF > def insert_string (str) > buf = VIM::Buffer.current > win = VIM::Window.current > buf.append(win.cursor[0], str) > end > EOF > > :ruby require 'date'; insert_string( Date.today.to_s ) Doh! :help if_ruby for more information. :) Tim
RSS Feed