Larry
Larry

Reputation: 3

Cannot Successfully Install Vim with Ruby Support in Ubuntu

I am using Ubuntu. Right now, the command :echo has('ruby') in my vim session will show 0. So I tried to fix the problem by the following commands,

sudo apt-get install ruby rubygems vim-nox

and run the command :echo has('ruby') again after restarting the operating system. However, it still shows 0. It seems that Rubby Support was not successfully installed in Ubuntu. What might be the problem and how can I fix this?

output of `:version' command in vim

Upvotes: 0

Views: 560

Answers (3)

Larry
Larry

Reputation: 3

I fixed my problem by running the command sudo update-alternatives --config vim and then type 3 to choose vim.nox; in this case, the sign in front of ruby is + after running the command vim --version.

Upvotes: 0

bk2204
bk2204

Reputation: 76409

First, check that the version of Vim you're using has Ruby support by running vim --version. That should print out a list of options, hopefully including +ruby. It should also print a set of features, right before that list. If you're using vim-nox, then you should see "Huge version" (either "with GUI" or "without GUI").

If you are missing either one of those, then you're probably configured to use the wrong Vim version. In Debian and Ubuntu, Vim is controlled by the alternatives system. Run sudo update-alternatives --config vim, which will provide you a list of Vims that are on your system. Ensure you pick the either /usr/bin/vim.nox or /usr/bin/vim.gtk3, since these versions have Ruby support. You can also pick automatic mode, since that should pick one of those versions if they're installed.

Upvotes: 1

Steven Aguilar
Steven Aguilar

Reputation: 3029

First, update the packages index:

sudo apt update

Install Ruby by typing:

sudo apt install ruby-full

To verify that the installation it was successful run the following command which will print the Ruby version:

ruby --version

The output will look something like this:

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

Upvotes: 0

Related Questions