简体   繁体   English

在使用ruby 1.9.2的rvm中运行时,使用ruby 1.8编译的vim 7.3

[英]vim 7.3 compiled with ruby 1.8 while running in rvm with ruby 1.9.2

I am running my rails 3 project under ruby 1.9.2 with rvm. 我正在使用rvm在ruby 1.9.2下运行我的Rails 3项目。 I use vim through zsh which was compiled using ruby 1.8 (the system ruby that comes with mac osx). 我通过zsh使用vim,zsh是使用ruby 1.8(mac osx附带的系统ruby)编译的。

What's the best way to get these two ruby versions to match up? 使这两个红宝石版本匹配的最佳方法是什么?

Option 1: I can have rvm use ruby 1.8 but I don't want to be "stuck" on 1.8. 选项1:我可以让rvm使用ruby 1.8,但是我不想被“卡在” 1.8上。 Plus my 'bundle exec rails' commands don't seem to work with this option. 另外,我的“ bundle exec rails”命令似乎不适用于此选项。

Option 2: Compile vim with ruby 1.9.2. 选项2:用ruby 1.9.2编译vim。 But will this work ok? 但这可以吗?

I know using macvim compiled with 1.9.2 is an option but I really prefer the terminal vim. 我知道使用以1.9.2编译的macvim是一种选择,但我确实更喜欢终端vim。

You would try one of these: 您可以尝试以下方法之一:

  1. You can use MacVim in Terminal. 您可以在终端中使用MacVim。 Just alias vim='mvim -v' if you already have mvim in your $PATH . 如果您的$PATH已经包含mvim ,则只需alias vim='mvim -v' I use this method personally, and I think it's the easiest way. 我个人使用此方法,我认为这是最简单的方法。

  2. Compile vim yourself, with --with-ruby-command=[PATH TO YOUR RUBY 1.9.2] configuration option. 使用--with-ruby-command=[PATH TO YOUR RUBY 1.9.2]配置选项自己编译vim I have not tried it on Mac OS; 我没有在Mac OS上尝试过; However in Ubuntu Linux I did --with-ruby-command=/usr/bin/ruby1.9.2 and it worked. 但是在Ubuntu Linux中,我做了--with-ruby-command=/usr/bin/ruby1.9.2并成功了。

FYI: In Ubuntu they keep every program with version number separated and use update-alternatives to switch the default. 仅供参考:在Ubuntu中,他们将每个程序的版本号分开,并使用update-alternatives切换默认值。 The /usr/bin/ruby is just a symlink to the default one. /usr/bin/ruby只是默认链接。

Rather than recompile vim, the easier solution is to change the /usr/bin/ruby symlink to point to your desired version of ruby. 除了重新编译vim之外,更简单的解决方案是更改/ usr / bin / ruby​​符号链接以指向所需的ruby版本。 I use RVM / mac OSX leopard, and this worked for me. 我使用RVM / mac OSX豹,这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM