Abbey Workshop

VIM and GVIM Settings for Mac OS X

Getting VIM setup the way you want on OS X can be a little difficult. I found an article at frymaster.dyndns.org that lists the facts. Here they are with a few edits.

Settings for .vimrc

" set our tabs to four spaces
set ts=4

" turn syntax highlighting on by default
syntax on

" set auto-indenting on for programming
set ai

" turn off compatibility with the old vi
set nocompatible

" turn on the "visual bell" - which is much quieter than the "audio blink"
set vb

" do not highlight words when searching for them. it's distracting.
set nohlsearch

" automatically show matching brackets. works like it does in bbedit.
set showmatch

" do NOT put a carriage return at the end of the last line! if you are programming
" for the web the default will cause http headers to be sent. that's bad.
set binary noeol

" make that backspace key work the way it should
set backspace=indent,eol,start

Settings for .gvimrc

Here are the settings for .gvimrc.

" syntax highlighting on
syntax on

" auto indent
set ai

" show line numbers
set nu

" tabs should be four spaces
set ts=4

" do not put a cr at the end of the file. this will result in headers sent if you do web programming
set binary noeol

" highlighting search results is annoying
set nohlsearch

" show matching brackets
set showmatch

" make that backspace key work the way it should
set backspace=indent,eol,start

" OPTIONAL
" show whitespace at end of lines
highlight WhitespaceEOL ctermbg=lightgray guibg=lightgray
match WhitespaceEOL /s+$/

" make the last line where the status is two lines deep so you can see status always
set laststatus=2

" vi compatible is LAME
set nocompatible

" no bell, please
set vb

" a better font...
set gfn=Monaco:h15:a

" set the screen width and height
win 80 25

The element marked OPTIONAL is designed to show trailing whitespace on the end of lines. If you find the grey bars annoying, just remove these lines.

The gfn=Monaco:h15 is key. This sets the default font to Monaco at 15 points. By default the font size was very small on my TiBook.

Thanks to Frymaster for writing this up. Very helpful stuff.