oFca
oFca

Reputation: 2830

Setting up Vim for Ruby on Rails

I work with Ruby on Rails and wish to use vim as the editor of choice. However, I can't find anywhere simple set of step by step,idiot proof, instructions with well explained steps as to how to set it up properly.

I wish to set vim properly, with nice plugins link vim for rails, nerdtree and stuff like that. Please help me, I would be most grateful.

So far I have installed RoR, vim, and git.

Upvotes: 15

Views: 9695

Answers (5)

smolnar
smolnar

Reputation: 736

Check out this bundle I created for Vim - smolnar/vim-rails-bundle. Might help setting up your environment.

Upvotes: 0

Bruno
Bruno

Reputation: 6449

Installing vim-rails using pathogen (recommended)

Copy and paste:

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

If you're using Windows, change all occurrences of ~/.vim to ~\vimfiles.

Add this to your vimrc:

execute pathogen#infect()

If you're lacking a vimrc, vim ~/.vimrc and paste:

execute pathogen#infect()
syntax on
filetype plugin indent on

Now any plugins you wish to install can be extracted to a subdirectory under ~/.vim/bundle, and they will be added to the 'runtimepath'. Observe:

cd ~/.vim/bundle
git clone git://github.com/tpope/vim-rails.git
git clone git://github.com/tpope/vim-bundler.git

AND/OR

Install Janus (includes some of the most popular vim plugins)

curl -Lo- https://bit.ly/janus-bootstrap | bash

Resources:

Upvotes: 0

phildobbin
phildobbin

Reputation: 834

There's also vim-ruby, vim-rake & vim-rvm to help you along too.

You could also consider using the duo of Pathogen & Vundle for auto installation. Pathogen was written by Tim Pope who wrote vim-rails. His Fugitive Git wrapper is invaluable also when using Git for source control for your Rails projects.

Upvotes: 3

iblue
iblue

Reputation: 30404

I was fiddling around with vim plugins as well, then I found out, that janus fits my needs quite well. It has a bunch of plugins I use regularily, like Ack.vim, NERDtree and SuperTab. And it is easy to install:

curl -Lo- http://bit.ly/janus-bootstrap | bash

I am not sure, if rails.vim is included or if I installed it myself. Check it out. Maybe it fits your needs.

Upvotes: 7

jdl
jdl

Reputation: 17790

You're probably not going to find "idiot proof" anything when it comes to vim. However, the good news is that it's really not that hard once you do it a few times. If you can get NERD tree installed, that's a good pattern for every other vim plugin out there.

The instructions for that plugin are simple enough.

Unzip the archive into your ~/.vim directory. That should put NERD_tree.vim in ~/.vim/plugin and NERD_tree.txt in ~/.vim/doc.

You don't really need any plugins to work with Ruby in vim, but the short list of plugins that I use regularly are:

Of those, the one that I use the most has nothing to do with Ruby specifically, but I find it to be faster than checking :ls for a buffer number. As long as I have bufexplorer plugged in, and ack installed on the system, I'm ready to slay some Ruby code. The other plugins are just "nice-to-haves".

Upvotes: 5

Related Questions