docwhat's avatardocwhat's blog

Updating VIM on OS X

The version of Vim that comes with OS X is a little old, but more importantly, it doesn’t have all the bells and whistles enabled.

Specifically, it doesn’t come with ruby and python support compiled in. Which is a shame, because some plugins for Vim need it.

I’ve been playing with Vim since a couple months ago when I was pair programming with a co-worker, Shawn. Shawn prefers Vim and he is very good at it.

To make pair programming easier, I decided to improve my very basic Vim skills. As part of that, I created a new .vimrc based on Shawn’s. I then went further and included Vundle and started looking at various packages.

We used this .vimrc during our pair programming and pushed it up as a Homedir package at http://github.com/docwhat/homedir-vim. I’ve successfully used this .vimrc on Windows (via Cygwin) and Centos version 5.6 and 6.2, as well as on the Mac. You can bypass Homedir entirely and just download the .vimrc directly.

However, to use some of the spiffy bits of my .vimrc on my Mac, I needed a Vim with all the extras. Here’s how you do it easily:

  1. Install Homebrew.
  2. Add the “duplicates tap”. This adds formulas for apps that duplicate the build-in OS X functionality: brew tap homebrew/dupes
  3. Install Vim: brew install homebrew/dupes/vim

That’s it. Easy-peasy!

Ciao!

UPDATE 2016/02/29: My .vimrc has been moved into my dotfiles repository.

Comments

Gravatar for jarek
jarek

Thanks for the tip. I had to use the fully-qualified recipe name, i.e. brew install homebrew/dupes/vim, not sure if this is a general brew thing or something particular to my setup.

Gravatar for docwhat
docwhat

Thanks for pointing that out. I fixed it above.

Gravatar for derek simeone
Derek Simeone

Tell me, have you or your coworker found a way to get the key bindings on the OS X version of Vim to match that of those on Linux? I love Vim but have the hardest time not getting frustrated with the OS X bindings.

Gravatar for docwhat
docwhat

I’m not sure what you mean by key bindings being different. I use the .vimrc mentioned above and it behaves the same for me on Linux and OS X.

Gravatar for derek simeone
Derek Simeone

Ah, sorry, I was referring to the control+left / control+right key bindings which makes moving between words significantly easier. However, if you’re on OS X, usually you can use option in place of control but apparently not in the OS X version of Vim.

Gravatar for docwhat
docwhat

I don’t use those keys. I use b or B and w or W to move around. So I guess I didn’t notice.

You can use the System Preferences to remap the control arrows. If that helps.

Submit a Comment

docwhat

The personal blog of Christian Höltje.
docwhat docwhat contact