Created
April 28, 2010 04:30
-
-
Save martinos/381733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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