How to change vim ruby version

I am a noob to vim and am wanting to use the command-t plugin, got really used to that in atom. I have done everything in the github repo but am unable to follow how to change the version of ruby that my vim is using. When I try to use the command-t it throws this error...

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

Except like I said, I'm having a hard time following the help on the repo and there it tells me that there is no help for command-t. So my question is, what is the best way to change my vim version?

Upvotes: 9

Views: 2158

Answers (2)

C S
C S

Reputation: 1535

What that error means is your vim uses a different version of ruby than command-t expects. Rather than change the version which vim uses, what you should do is recompile command-t with vim's version of ruby.

In my case I used Homebrew to install vim, which will install its own ruby but without rbenv. I also use Pathogen for plugins so I have my command-t install under ~/.vim/bundle/command-t (with the 5-x-release branch checked-out since i don't use neovim).

What I did was basically from this blog post:

  • find where brew's ruby is: which vim gave /opt/homebrew/bin/vim and eventually i was able to find ruby at /opt/homebrew/opt/ruby/bin/ruby
  • cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
  • /opt/homebrew/opt/ruby/bin/ruby extconf.rb
  • make clean
  • make

after that, it worked!

Upvotes: 1

garythegoat
garythegoat

Reputation: 1587

Try the following:

  1. $ cd ~/.vim/bundle/command-t/ruby/command-t/
  2. $ rbenv local system
  3. $ ruby extconf.rb
  4. $ make clean
  5. $ make

Taken from this post. I've had this problem before and these steps worked for me.

Upvotes: 9

Related Questions