Ruby and Vim

Vim/Ruby Configuration Files

 * http://vim-ruby.rubyforge.org/

Or install with gem install vim-ruby ruby /ruby/lib/ruby/gems/1.8/gems/vim-ruby-2006.07.11/bin/vim-ruby-install.rb

Output From Ruby into Vim
Put the approximate value of $$\pi$$ into the text :r!ruby -e 'print Math::PI'

Multi-line Evaluation
for x in 1..10 puts x**2 end .

Filtering Range with Ruby
Whole file: :rubyd gsub /something(.*)else/,'\1' Single line: :.rubyd gsub /something(.*)else/,'\1' Reverse whole file: :rubyd $_.reverse! This more complex example makes the text uppercase and centers it :rubyd $_=$_.upcase.center(VIM::evaluate("&tw").to_i) See the article on Utility Ruby for more filtering examples.