Contents |
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
:rub puts 2**16
Put the approximate value of π into the text
:r!ruby -e 'print Math::PI'
:rub<<
for x in 1..10
puts x**2
end
.
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.