Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thinking of moving from TextMate to vim for Rails dev. What do I need?

Tags:

I do Ruby on Rails development pretty much exclusively. I currently develop in OS X using TextMate. I have a virtual machine running to emulate as closely as possible the environment my app will be deployed into, and I mount the code on a Samba share into OS X from the VM guest. From there I open with TextMate and code away.

I'm beginning to think that with the proper plugins and time spent learning, I could be much more productive in vim directly on the VM. Right now my TextMate is basically stock, though I do find the ProjectPlus plugin indispensable. What I'm looking for are some suggestions of vim resources and plugins (if that's the right terminology) to closely emulate the features I am unwilling to give up in TextMate. Or at least, compelling reasons why I should be willing to give them up. Here's a short list:

  • Ability to have a (preferably) collapsible project tree visible either at all times or easily toggle-able.
  • Ability to see SCM status at a glance, either within this project tree (preferable) or otherwise. (I use git almost exclusively if this makes any difference.)
    • Being able to view a side-by-side diff from within vim would be great too
  • Ability to search through the entire project at will (I suppose :stop; grep -nr; fg; would accomplish this, unless there's a better way to do it.)
  • Code completion, if possible
like image 909
Josh Lindsey Avatar asked Feb 15 '10 22:02

Josh Lindsey


2 Answers

The NERD Tree plugin gives you a collapsible project tree. Personally, I find that the netrw plugin is more than sufficient, and this usually comes installed with Vim. Whereas the NERD tree feels as though it tries to emulate the behaviour of other IDEs (and TextMate's project drawer), I feel that the netrw plugin does things the Vim way. I suggest you try both out, and see which one you prefer.

The fugitive plugin provides a git interface to Vim (See Vimcasts: parts 1, 2, 3, 4 and 5).

The ack plugin is great for searching an entire project. You'll want to read up on Vim's quickfix list to get the most out of this.

TextMate's word completion is triggered with esc, and shift-esc. In Vim, you get similar autocomplete functionality using ctrl-n and ctrl-p in insert mode. Check :help ins-completion for (much!) more info.

I am running a series of screencasts about learning Vim over at vimcasts.org. My background is with TextMate, but I've been using Vim fulltime for a while now. As I write this, I'm only 6 episodes in, but I do plan on covering each of the points you've raised in future episodes. I'll try and come back to edit this answer with links to the screencasts as they become available.

like image 83
nelstrom Avatar answered Oct 27 '22 00:10

nelstrom


And snipMate : TextMate-style snippets for Vim

like image 26
allenwei Avatar answered Oct 27 '22 01:10

allenwei