Command-t Use of Vim plugin

Source: Internet
Author: User
Tags autoload using git

Recently in the use of VIM plug-in Commandt when the problem is actually VIM does not support Ruby, but Google found a solution, the attitude of the foreigner is very admirable, the results of Niang search too let people disgusting.

Affixed, and then again encountered the solution.

One of the first things I do after installing a fresh copy of Ubuntu was grab an updated Vim with RubySup Port and proceed to install the amazing command-t plugin. However, this isn ' t exactly the most straightforward process. So I thought it would is a good idea to document the process and share it with your all. So without further ado, let's Get started!

Install Vim with Ruby support

The first thing you want to does is open your terminal and install Vim-nox. Vim-nox is a minimal version of Vim This allows you to run vim in your terminal, and comes compiled with Ruby support. Here's a link that'll explain all the Vim versions in detail.

sudo apt-get install vim-nox

Your VI and vim commands should now call Vim-nox instead of Your system ' s default vim. Let's restart our terminal after you has installed this just to make sure.

Install Pathogen-vim Plugin Manager

I highly recommend installing pathogen for managing your Vim plugins. Pathogen just makes installing plugins simpler and keeps them organized better. Run the following install pathogen.

mkdir -p ~/.vim/autoload ~/.vim/bundle; curl -Sso ~/.vim/autoload/pathogen.vim     https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim

Now on the top of your ~/.vimrc file, add this line:

execute pathogen#infect()

Alternatively, if you don ' t already has a ~/.vimrc , you can create this minimal version of a. VIMRC:

execute pathogen#infect()syntax onfiletype plugin indent on

This was the Github page for pathogen, and I recommend skimming over it if you had time.

Install command-t

To install the Command-t plugin, you can either with git, or manually download and install it to your ~/.vim/bundle directory.

Using git

cd ~/.vim/bundlegit clone https://github.com/wincent/Command-T.git

Manually installing

Go to the Command-t Github page and click the Download Zip button. Extract the contents of zip file to the ~/.vim/bundle directory.

Pathogen'll automatically run plugins in while you ~/.vim/bundle start Vim

Install RVM and Ruby

Skip this next part if you already has Ruby and RVM installed already

You can check if you have a Ruby installed by doing and ruby -vrvm -v

If you get a message saying The program ‘ruby‘ can be found in the following packages , you need to install Ruby and RVM.

1. Install RVM Dependencies

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion nodejs

2. Install RVM

curl -L https://get.rvm.io | bash -s stable --ruby

3. Set. BASHRC for RVM scripting

echo ‘[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"‘ >> ~/.bashrc

Now you can restart your terminal, and ruby -v should work.

Compile command-t using the Ruby version that your Vim are installed with

If you see the "Error: When you command-t.vim could not load the C extension try to runcommand-t in your Vim," This section would help solve that problem.

This was the part, trips most people. You must compile command-t using the same version of Ruby/your Vim is linked against. This basically means if your command-t ' s ruby version doesn ' t match your Vim ' s ruby version, command-t'll not work. First let's find your system ' s version of Ruby.

Compare the versions of Ruby from the following and the commands:

ruby -vvim --version | grep ruby

You should see something similar to the following screenshot:

Here is the following steps to now compile command-t with the correct Ruby version:

1. Install and use the version of Ruby that matches your Vim ' s

Find the version of Vim from the command we ran earlier vim --version | grep ruby (in my case, it ' s1.8). Just look through the output and it should is a number like 1.8 or 1.9.1 or 2.0.0, something Si Milar to that. Next do:

rvm use #YOUR_VIM‘s_VERSION_OF_RUBY

For example, in my case, my Vim is compiled with Ruby version 1.8, so my command would is rvm use 1.8 . If you get a message saying like ruby-1.8.7-p374 is not installed. , follow the To install do: ‘rvm install ruby-1.8.7-p374‘ warning in your console. Again the version of Ruby that your Vim was installed with.

After you has installed the proper version of Ruby, make sure this your system is actually using it.

rvm use #YOUR_VIM‘s_VERSION_OF_RUBY

2. Navigate to your command-t bundle directory

cd ~/.vim/bundle/Command-T

3. Compile command-t using your Vim ' s Ruby Version

Now the is in your command-t bundle directory. Do the following:

rake make

That's should recompile command-t with the proper version of Ruby, and your command-t ' s and Vim's Ruby versions should now M Atch.

Run command-t

Now for all of the your hard work, the reward yourself by opening Vim and running command-t to the see its awesomeness.

vim:CommandT
If you had any problems, comment below and I'll try to answer ASAP. Well, hope the helps someone out, thanks for reading!

However, some of the points to be aware of is that the vim version and Ruby version must correspond, this is a big pit ...

Command-t Use of Vim plugin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.