mcramm.com

Vim Reboot 1

Over the past few years my Vim configuration has gotten out of hand. I’ve tried to maintain it as best I can, but its time for a reboot. I was inspired by Avdi Grimm’s recent Emacs Reboot series and decided to do something similar for Vim.

I work on a Mac, which means I prefer to use MacVim where possible. The latest snapshot for Snow Leopard can be found at http://code.google.com/p/macvim/ and installing is as easy as you would expect. Simply download the snapshot, drag MacVim.app to Applications and move the mvim script to folder in your path:

sudo mv mvim /usr/bin

Using mvim from the command line at this point should launch MacVim as you would expect.

At this point, you have two options. You can continue with this series of posts on customizing your environment by hand, or you can check out Janus and get a very good default configuration. I used this initially and copied a bit of my configuration directly from it.

The first thing I wanted to do was fix the (ugly) default color scheme and setup MacVim to work in full screen mode.

Create a .gvimrc file:

touch ~/.gvimrc

And add the following to it:

if has("gui_macvim")
    " Make fullscreen mode take up the full screen
    set fuoptions=maxhorz,maxvert

    "set the font
    set guifont=Menlo:h10

    " Command-Return toggles full screen mode
    macmenu Window.Toggle\ Full\ Screen\ Mode key=<D-CR>
endif

" Start with the toolbar hidden
set guioptions-=T

" Set the color scheme
set background=dark
color ir_black

Substitute the “Menlo” font and “ir_black” color scheme with the font/scheme of your preference.

Menlo should be available on your Mac if you have Snow Leopard. If you don’t have it, then you should try out Bitstream. Installation details can be found elsewhere on their website.

ir_black can be found in a bunch of places, the best of which is here. You can use this scheme by doing:

  mkdir -p ~/.vim/colors
  mv ir_black.vim ~/.vim/colors/

Running mvim from the command line should present the following:

Vim

Next I’ll start setting up some standard vim options and a couple of custom mappings I use quite frequently.