Scripting Vim With Ruby [PDF]

12 downloads 270 Views 4MB Size Report
Page 14. Calling Ruby From Vim. 108221123, Ryan Lane/Vetta. Page 15 ... Three Way To Call Ruby. 108281011, Jun Takahashi/Riser. Page 17. Inline Ruby.
Scripting Vim With Ruby

Matt Margolis Getty Images Madison, WI @mrmargolis

sb10068645j-001, Tara Moore/Riser

Scripting Vim With Ruby

73029870, Sean Justice/Stockbyte


The scripting language that comes with Vim You have already seen it if you have ever edited your .vimrc file or configured a plugin



To Learn More :help vim-script

VimScript + Ruby

BA61201, Hulton Archive

VimScript + Ruby Adds a dependency on Ruby, but you get a lot in return.

• Ruby’s Standard Library • RubyGems • You are probably more comfortable in Ruby than VimScript


81899092, Daisy Gilardini/The Image Bank

:help ruby

• image of :help ruby

Ruby Support?

No rubies? Oh gnoes!!

97602532, Miss Maggie/Flickr

Which Ruby?

• MRI 1.8.7 is the safe choice • The internets indicate that 1.9.2 is possible but buggy

Vim With Ruby Support installing-vim-with-ruby-support-ruby

Calling Ruby From Vim

108221123, Ryan Lane/Vetta

Calling Ruby From Vim

To load these examples either • Put the code in your .vimrc • Put the code in a .vim file Then :source /path/to/file/you/used

Three Way To Call Ruby

108281011, Jun Takahashi/Riser

Inline Ruby

:ruby puts “awesome”.upcase Vim will echo AWESOME at the bottom of your screen

Inline Ruby Example: How I figured out which ruby is being used function! RubyInfo() ruby