如何更改Vim ruby版本

g2ieeal7  于 7个月前  发布在  Ruby
关注(0)|答案(2)|浏览(46)

我是Vim的新手,我想使用command-t插件,在atom中已经习惯了。我已经在github repo中做了所有的事情,但无法遵循如何更改Vim使用的ruby版本。当我尝试使用command-t它抛出这个错误.

command-t could not load the C extension.
Please see INSTALLATION and TROUBLESHOOTING in the help
VIM Ruby version 2.0.0-p648
Expected version 2.4.1-p111
for more information type:   :help command-t

除了像我说的,我有一个困难的时间以下的帮助对回购,它告诉我,没有帮助的命令t。所以我的问题是,什么是最好的方法来改变我的Vim版本?

t9aqgxwy

t9aqgxwy1#

请尝试以下操作:

  1. $ cd ~/.vim/bundle/command-t/ruby/command-t/
  2. $ rbenv local system
  3. $ ruby extconf.rb
  4. $ make clean
  5. $ make
    来自this的文章。我以前遇到过这个问题,这些步骤对我很有效。
vfh0ocws

vfh0ocws2#

这个错误意味着你的Vim使用的ruby版本与command-t预期的不同。与其改变Vim使用的版本,你应该做的是用vim的ruby版本重新编译command-t。
在我的例子中,我使用Homebrew安装了vim,它将安装自己的ruby,但没有rbenv。我也使用Pathogen作为插件,所以我在~/.vim/bundle/command-t下安装了命令-t(由于我不使用neovim,所以检查了5-x-release分支)。
我所做的基本上是从this blog post

  • 找到布鲁的Ruby在哪里which vim给出了/opt/homebrew/bin/vim,最终我在/opt/homebrew/opt/ruby/bin/ruby找到了ruby。
  • cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
  • /opt/homebrew/opt/ruby/bin/ruby extconf.rb
  • make clean
  • make

在那之后,它起作用了!

相关问题