Skip to content

Instantly share code, notes, and snippets.

@martinos
Created April 28, 2010 04:30
Show Gist options
  • Save martinos/381733 to your computer and use it in GitHub Desktop.
Save martinos/381733 to your computer and use it in GitHub Desktop.
require 'tempfile'
def vi(txt, arguments_str = "")
Tempfile.open('rubyview') do | file |
file << txt
file.close
cmd = "vim #{arguments_str} \"#{file.path}\""
system( cmd )
end
end
class String
def to_vi(filetype = "")
vi( self, "-c 'set filetype=#{filetype.to_s}'" )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment