Created
November 19, 2011 01:39
-
-
Save slyphon/1378293 to your computer and use it in GitHub Desktop.
vim environment cleaner-upper
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
#!/usr/bin/ruby | |
# scrubs the vim environment to prevent segfaults because builtin ruby | |
# tries to load rubygems from rvm | |
THIS_FILE = File.expand_path(__FILE__) | |
def find_vim | |
ENV['PATH'].split(':').each do |p| | |
path = File.expand_path('vim', p) | |
next if path == THIS_FILE | |
return path if File.exists?(path) | |
end | |
raise "Fuck! couldn't find a vim that's not us!" | |
end | |
ENV.delete_if do |k,v| | |
k =~ /^(rvm_|RUBY|RI$)/ | |
end | |
ENV['PATH'] = "#{ENV['HOME']}/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/X11/bin" | |
ENV['SKIP_RVM'] = '1' | |
exec(find_vim, *ARGV) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment