Tuesday, November 08, 2005

GVim Configuration Tip

I found a great article on setting up GVim on Mac OS X (should work on any version of GVim, actually), and I thought I would share it. I made a few minor changes to the settings to the version I found. GVim, by default uses a small font, and some default settings aren't that great. Below, is my configuration file, with comments above as to what each line does. You can copy the red text below straight into GVim, and save it to your home directory as .gvimrc and when you start GVim the next time, the settings will take effect.

" 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

" 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:h12:a

" Windows users, use one of these instead...
" set gfn=Courier:h12
" set gfn=Lucida\ Console:h12

" set the screen width and height
win 80 40

1 comment:

Anand said...

Really helpful. Thanks :)