I don’t know why, but vi on the mac doesn’t highlight syntax by default. Searching Google was particularly hard to find the answer, so I’m adding it here (particularly for when I forget how I did it.)
An aside: apparently vi actually just redirects to vim in Snow Leopard.
This site has lots of useful configuration options to consider to make vim more useful.
The particular problem I wanted to solve (making vim colourful – as in enabling syntax highlighting) is done so by adding the following to your .vimrc file
" File-type highlighting and configuration.
" Run :filetype (without args) to see what you may have
" to turn on yourself, or just set them all to be sure.
syntax on
filetype on
filetype plugin on
filetype indent on
The .vimrc file is located in your home directory, and affects vi and vim everywhere (including through SSH and in screen). There’s lots of options you can add to it. Here’s the selection I’ve gone for, after reading the article linked above.
" config from http://items.sjbach.com/319/configuring-vim-right
" Intuitive backspacing in insert mode
set backspace=indent,eol,start
" File-type highlighting and configuration.
" Run :filetype (without args) to see what you may have
" to turn on yourself, or just set them all to be sure.
syntax on
filetype on
filetype plugin on
filetype indent on
" Highlight search terms...
set hlsearch
set incsearch " ...dynamically as they are typed.
set hidden
let mapleader = ","
set wildmode=list:longest
set ignorecase
set smartcase
set scrolloff=3
set ruler
" Use ,s to see hidden chars
set listchars=tab:>-,trail:·,eol:$
nmap <silent> <leader>s :set nolist!<CR>
Awesome. Works perfectly! Thanks