Command T is a Vim Plugin that is Ruby based. It enables to make a fuzzy search for files and in files.
To The Point
Installation
To install Command_T you need to have ruby addons in vim.
Check out if you have ruby-support in vim with vim command:
:ruby 1
If you are so lucky as I am and you have following output:
E319: Sorry, the command is not available in this version
Than you have to add ruby-support to your vim or install vim with pre-existing ruby support.
Installing Vim with Ruby support
If you use Ubuntu system, you can install vim with ruby support with:
sudo apt-get install -y vim-nox;
For other, I'd suggest to build vim with commands shown in this stackoverflow answer:
git clone https://github.com/vim/vim vim
cd vim
./configure --enable-rubyinterp
make
sudo make install
Installing vim-plugin.
After enabling ruby support in vim, you need to add this to your vimrc using Vundle :
Plugin 'wincent/command-t'
Usage
To use you can invoke it with <Leader>t
- so the \t
standard vim combination.
Well ... My first usage outputed with this beautiful error:
command-t.vim could not load the C extension.
Please see INSTALLATION and TROUBLE-SHOOTING in the help.
Vim Ruby version: 1.9.3-p484
Expected version: [unknown]-p[unknown]
For more information type: :help command-t
What it means? it means that we need C extension for the plugin to work properly.
The documentation with this installation guide gives information that we should go to vim-plugin folder:
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
And compile extension with:
ruby extconf.rb
But my system does not have all ruby-extensions and building tools, so it failed with:
Unable to require "mkmf"; you may need to install Ruby development tools
(depending on your system, a "ruby-dev"/"ruby-devel" package or similar).
[exiting]
Let's install them:
sudo apt-get install -y ruby-dev
And now checking again compilation goes with this effect:
ruby extconf.rb
checking for float.h... yes
checking for ruby.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for fcntl.h... yes
checking for stdint.h... yes
checking for sys/errno.h... yes
checking for sys/socket.h... yes
checking for ruby/st.h... yes
checking for st.h... yes
checking for pthread_create() in -lpthread... yes
creating Makefile
Now let's make
this.:
make
Outputs with:
compiling heap.c
compiling ext.c
compiling matcher.c
compiling match.c
compiling watchman.c
linking shared-object ext.so
So it means we are good to go ?
Checking... Yeah!! It works.
Snippets
Installation
sudo apt-get install -y vim-nox;
sudo apt-get install -y ruby-dev;
VimRC:
Plugin 'wincent/command-t'
Building plugin:
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
ruby extconf.rb
make
Acknowledgements
Auto-promotion
Related links
- Installing vim with ruby support (+ruby) - Stack Overflow
- GitHub - wincent/command-t: Fast file navigation for VIM
Thanks!
That's it :) Comment, share or don't - up to you.
Any suggestions what I should blog about? Post me a comment in the box below or poke me at Twitter: @anselmos88.
See you in the next episode! Cheers!
Comments
comments powered by Disqus