Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 975
oFca Avatar asked Feb 11 '12 22:02

oFca


People also ask

Is Vim good for Ruby?

Many Rails programmers prefer Vim to full-blown bulky IDEs like RubyMine. The are several reasons for that but most important (to me at least) is the ability to customize Vim, make it very powerful and at the same time keep it pretty lightweight.

Where do I put Vim plugins?

Installing a Plugin Manually Starting with Vim version 8, you can install plugins without the need for a package manager by using the default package management tool. You can place Vim plugins in the ~/. vim/pack/vendor/start/plugin_name directory. Note that the plugin_name folder name will vary from plugin to plugin.


2 Answers

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.

like image 113
iblue Avatar answered Sep 18 '22 15:09

iblue


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:

  • bufexplorer -- Easily the one that I use most often. Hundreds of times daily.
  • NERD Commenter
  • NERD tree
  • rails

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".

like image 37
jdl Avatar answered Sep 19 '22 15:09

jdl