I’ve been a vi user for many, many years. In fact, I used to program in C on a MUD using ed (vi is the fancy version of ed). However, it’s been a long time since I used vi as my editor of choice for development work. I use it for hacking scripts, editing files on servers, and general purpose text editing in a terminal window, but most of the time I use Eclipse for Java and TextMate for pretty much everything else.
A lot of people in the Rails community have migrated over to vim (and MacVim) in recent years, and I know there’s a very active community of programmers who are working hard to make it a better tool for developers. Anyway, I wanted to try out the Solarized color scheme people were talking about and Vim looked like the best option, so I decided to dive in, at least for Rails development.
I’ve been really impressed. Tim Pope’s rails.vim library for Rails developers is really, really good. The navigations features in particular are worth the price of entry. Then there’s the inherent goodness of Vim itself. Vim is difficult to approach initially, but it’s an incredibly powerful tool in the hands of someone who really knows how to use it. Even though I have been using it for a long time, I don’t really consider myself to be a Vim power user by any stretch of the imagination, because I’ve mainly used it to edit small files, one at a time.
Using Vim for project work is completely different, and that’s the area where my Vim skills need work. TextMate provides you with a file drawer with all of the files in your project, easy to use search across all the files in a project, and the ability to easily open multiple files in a tabbed editor and switch between them. The next step is to learn the tricks to accomplish the same things using Vim. Anyone seen a good tutorial?
Update: Just for fun, here’s my .vimrc.
April 19, 2011 at 9:06 pm
NERDtree (https://github.com/scrooloose/nerdtree) does the file drawer thing for Vim, but honestly since I’ve started using FuzzyFinder (http://www.vim.org/scripts/script.php?script_id=1984), I hardly ever use NERDtree anymore.
Also, before you try either, install Pathogen (https://github.com/tpope/vim-pathogen). It will change your life.
April 19, 2011 at 9:47 pm
I remember debating with a fellow student which editor was better: vi or XEDIT (editor on IBM mainframes). In 1985. XEDIT won.
Of course I always end up using vi when ssh’ing into servers, but pretty rarely use it on my desktop. Haven’t been frustrated enough with BBEdit to use vi as my “main” editor.
I’m curious why Rails-istas have moved from TextMate to vim. Something wrong with TextMate? Folks doing a lot of work on *nix?
April 19, 2011 at 11:04 pm
I have already grabbed Pathogen. I confess that I was disinclined to install NERDtree because the capitalization of the name kind of bugs me.
April 19, 2011 at 11:24 pm
I’m quite partial to vim in combination with GNU Screen: http://jmcpherson.org/screen.html
April 20, 2011 at 2:55 am
I generally use cscope with vim. A couple years ago using ruby I also had some kind of tags generator (exuberant ctags supports ruby, I believe). Cscope isn’t as fabulous for Ruby as it is for c/c++/java, but it’s still pretty awesome, imho.
Anyways, with vim+cscope+screen I rarely have to move my hand to the mouse when editing.
April 20, 2011 at 3:47 am
s/fancy version of ed/fancy version of ex, which is in turn the fancy version of ed/
April 20, 2011 at 7:18 am
I tried out solarized too and I couldn’t seem to get into it. I’m using vividchalk –
http://bit.ly/dZ3Vf5
Tim Pope made it (https://github.com/tpope/vim-vividchalk). Perhaps I just got used to it.
April 20, 2011 at 9:14 am
Janus (https://github.com/carlhuda/janus) is a great set of vim plugins and customizations. Even if you don’t want to use it as a starting point it’s a solid list of things to look in to.
Especially of note for you, it includes a plugin called Command-T which provides the same file search behaviour to vim as that key sequence starts in TextMate.
April 20, 2011 at 9:15 am
Patrick, I’ve never been a TextMate user but my impression is that many people are getting frustrated with the lack of updates, and by moving to vim the community is creating all the things they wish TextMate could do.
April 20, 2011 at 8:36 pm
It’s easy now to have a copy of your production environment (or something close to it) running in a virtual machine on your laptop where makes sense to just use vim in a checkout of your source tree there, instead of juggling versions of Ruby/Python/ModPerl on your Mac.
My only hassle was installing debian build tools and making vim 7.3 from source.
If you’re doing any JavaScript work, I recommend the vim plugin for JSHint: https://github.com/wookiehangover/jshint.vim
April 21, 2011 at 11:06 am
Plain old :b(uffer) is great for navigating files that you have open. Just type in :b and any part of the filename and hit tab. With that and :sp(litscreen) you are set!
April 23, 2011 at 4:01 pm
All good recommendations. I’d start with Steve’s post below. He goes over a bunch of advanced vim techniques and plugins he uses. I think his focus is a little more on C than ruby but the lessons are similar.
http://stevelosh.com/blog/2010/09/coming-home-to-vim/
Most of the good and maintained vim plugins have migrated to github.
September 7, 2011 at 1:46 pm
I wrote a Textmate to VIM guide where I detail how to do 110 Textmate features in VIM. I think it would be a great resource to add to this page. http://www.jackkinsella.ie/2011/09/05/textmate-to-vim.html