Installing vim with ruby support (+ruby)

RubyVim

Ruby Problem Overview


I'm trying to get command-t installed for vim but my current version of vim doesn't have the (+ruby) flag. The command "which ruby" shows that ruby is installed.

What do I need to do in order to activate the +ruby flag in vim?

Also, what does the +ruby flag technically mean?

Ruby Solutions


Solution 1 - Ruby

Some package provides vim-ruby on Ubuntu, for example vim-nox.

simply:

sudo apt-get install vim-nox;

will get you vim with ruby, as well as compiled in "support for scripting with Perl, Python, Ruby, and TCL but no GUI."

sudo apt-get install vim-rails

will install a "selection of vimscripts that make editing Ruby on Rails applications extremely easy." but as it depends on vim-full and vim-addon-manager, it will also install the vim-gnome version of the GUI, that is "a version of vim compiled with a GNOME2 GUI and support for scripting with Perl, Python, Ruby, and TCL."

Solution 2 - Ruby

I think "Compiling Vim With Ruby Integration On Snow Leopard" might actually help. I'm on exactly same boat at the moment.


Ok... got it to work. Took me like half hour or so.

This should help (I got Ubuntu):

sudo apt-get install mercurial
hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --enable-rubyinterp
make
sudo make install

To test if things look fancy:

vim --version | grep ruby

Should return something like:

-python3 +quickfix +reltime -rightleft +ruby +scrollbind +signs +smartindent

Ruby should have plus now. Another trick to test it - enter vim and hit :ruby 1. Should not fail.

Solution 3 - Ruby

On mac os x, assuming you have Homebrew installed:

brew install https://raw.github.com/Homebrew/homebrew-dupes/master/vim.rb

This version of vim has ruby support enabled

Source: http://blog.jerodsanto.net/2011/08/brew-install-vim/

EDIT: edited the url, thanks @david-xia for mentioning the change

UPDATE: Apparently, homebrew vim now comes with ruby support enabled by default so you just need to do brew install vim (see comment below)

Solution 4 - Ruby

If there isn't a Ruby enabled Vim available for your operating system, you'll have to recompile. This is very easy and there are some instructions on the Vim website I believe. If you're on Linux, you use configure to choose what you want. Have a look at the output of:

./configure --help

in the Vim source directory. Read it carefully, there are a lot of options in there. The main one you want is --enable-rubyinterp, but you may also want to add --with-features=HUGE among others. As I said, read the help provided.

Solution 5 - Ruby

when you run ./configure you need to add the folowing --enable-rubyinterp

./configure --enable-rubyinterp

Solution 6 - Ruby

On Mac OS X, I find that the easiest is to install MacVim with brew install macvim which includes +ruby. And then symlink /usr/local/bin/vim to /usr/local/bin/mvim. That way to get a recent Vim version, with the huge feature set, +ruby, both GUI and command line vim just using the standard HomeBrew repository. No need for external repository like in Pierre answer

To avoid issues it's better to use the use the system ruby during installation so:

rvm use system
brew install macvim
ln -s /usr/local/bin/mvim /usr/local/bin/vim

Solution 7 - Ruby

Flag +ruby means that vim is compiled with ruby support and linked against ruby interpreter library. You cannot get this flag without recompiling vim or installing another version which is compiled with this flag.

Solution 8 - Ruby

Pulling the vim source using Mercurial and changing into the directory will give you the ability to configure your vim install before you compile it.

hg clone https://vim.googlecode.com/hg/ vim
cd vim
./configure --enable-rubyinterp

The --enable-xxinterp option can be used for Python, Perl, or any other language that Vim will support. Just type it in where the xx is and it will work.

Running the help option with the configure command will allow you to see all of the configuration options.

./configure --help

Solution 9 - Ruby

Under Windows you can install Vim from here:

http://sourceforge.net/projects/cream/files/Vim/

Version 7.3.3 seems to be compiled with Ruby support (see release notes file). The newest 7.3.x currently is not.

Solution 10 - Ruby

Installing vim-rails will add Ruby (+ruby) support. I just tried and verified that it works and Command-T runs fine now.

sudo apt-get install vim-rails

Solution 11 - Ruby

If you are using MacPorts in OSX, you may try

sudo port install vim +ruby

To specify a different ruby version, you may try

sudo port install vim +ruby18

or

sudo port install vim +ruby19

Solution 12 - Ruby

It looks like you need to have ruby installed before install vim-nox.

This works for me on Ubuntu 18.10

sudo apt-get install ruby rubygems vim-nox

Source: https://junegunn.kr/2013/09/installing-vim-with-ruby-support

Solution 13 - Ruby

If you are lazzy and don't want to recompile you can try to find a package with a vim version including ruby. On debian it's vim-ruby so something like

apt-get install vim-ruby 

might work. (I can't try it, I m on mac. On mac , MacVim come with ruby enabled)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChris GreerView Question on Stackoverflow
Solution 1 - RubyDenMarkView Answer on Stackoverflow
Solution 2 - RubyArnis LapsaView Answer on Stackoverflow
Solution 3 - RubyPierreView Answer on Stackoverflow
Solution 4 - RubyDrAlView Answer on Stackoverflow
Solution 5 - RubyskeeptView Answer on Stackoverflow
Solution 6 - RubyRubenLagunaView Answer on Stackoverflow
Solution 7 - RubyZyXView Answer on Stackoverflow
Solution 8 - RubyamargherioView Answer on Stackoverflow
Solution 9 - RubyMattView Answer on Stackoverflow
Solution 10 - RubyMike CrittendenView Answer on Stackoverflow
Solution 11 - RubyChuan MaView Answer on Stackoverflow
Solution 12 - RubyShuo FengView Answer on Stackoverflow
Solution 13 - Rubymb14View Answer on Stackoverflow