Getting Started with Vim

I’m giving Vim a try for the next 30 days (well, 27 days now) as my only editor. I just switched over to a Macbook Air as my main development machine so I am not even going to install TextMate or any other editors besides MacVim. I’ve made a couple attempts in the past at getting into Vim, but I just found myself getting frustrated at how unproductive I was and I quickly switched back to TextMate.

I’m already a couple days in to the challenge and have really enjoyed learning about all the editor has to offer. Partially to keep myself accountable to the challenge and partially to help others who are trying to make the switch to Vim, I’m going to be sharing my experiences here along the way. I’ll be giving my perspective coming from TextMate to Vim but I will try to share any tips and tricks I learn along the way that I find are improving my productivity.  I’d also be happy to answer any questions people have, so feel free to ask away in the comments.

The First Few Days

I’m already a few days in to the challenge and have had my fair share of struggles figuring out how to do things that were already part of my workflow in TextMate. I’m getting fairly comfortable with the editor and I would say that I’m about 90% as productive as I was previously in TextMate and I still have a lot to learn.

Here are a few things things that have been important to my adoption of the editor.

Multiple Editing Modes

This was tough to get used to at first. Remembering to switch between insert, visual and normal mode was a bit of a pain and I found myself typing a lot of nonsense when I would forget to jump in or out of a certain mode, but I’m pretty much past that. I’m already enjoying a lot of the commands that are available in normal mode and I would probably miss them if I were to make the switch back at this point.

Working with Multiple Files

One of the biggest differences with MacVim and pretty much any GUI editor out there is that you don’t have a file tree to look through and open files. Opening files with the default command (:e) is a bit of a pain, especially in large projects, but I realized that PeepOpen could bring back the awesome Go to File… command from TextMate (Command + T). This alone was a huge time saver.

If you haven’t heard of PeepOpen, you should check it out. If you are a MacVim or TextMate user, it is an awesome add on that can help you a lot when working with multiple files.

Learning My First Few Commands

To get my feet wet with Vim I tried out the built-in vimtutor that comes with the editor. It was a great introduction and easily worth the 45 minutes or so it took to get through it. Even if you aren’t using Vim on a regular basis, I would highly recommend it to anyone who has to do any editing of files over an SSH connection just so you have the basics of Vim under your belt for those few occasions that you actually have to use it.

To start vimtutor, just go to your Terminal and type vimtutor. That’s all there is to it! It’s really just a big text document that walks you through the Vim commands, but it’s very well done and covers all the basics you need to get started.

Next Steps

I’m still trying to work my way to some more advanced features, but am hoping to get through the Smash Into Vim screencasts from PeepCode in the next couple weeks. I am starting to get the hang of finding and replacing in Vim, but it takes me a while yet so I want to practice up on my regular expressions and understand all the possibilities of the vimgrep command. I also haven’t done any remote editing but am excited to try working with files over SSH.

What I Miss

Although there are a lot of things I like more about MacVim, there are a few things that I really miss.

  • Bundles – not a dealbreaker, but it would be nice to have some of my old bundles for PHP/CodeIgniter and Ruby/Rails.
  • Git Integration – I loved the Git bundle for TM and used it for all of my commits.
  • Find in Project – I used this command all the time, and it will take me a while to get used to finding and replacing in Vim.

I’m guessing all of these issues are not shortcomings of the editor, but only my lack of knowledge about it.

Leave a Reply

Your email address will not be published. Required fields are marked *