.vimrc contains Vim commands executed upon startup and allows you to tweak the editor's behaviour in a myriad of ways. Here is a minimal collection of some sensible non-default settings.
set nocompatible " allow breaking vanilla vi compatibility - required for adv. features
set incsearch " Enable incremental searching by default
set showmatch " Highlight the matches of the last search
set backspace=2 " allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set textwidth=0 " Don't wrap words by default
set ts=4 " Change tab spacing to a lower value (default=8)
" Vim 5+ comes with syntax highlighting for many languages, enable it if available
if has("syntax")
syntax on
endif
set background=dark " better syntax colours for black terminals
set encoding=utf-8 " you really should be using utf-8 now
set termencoding=utf-8 " ditto
set fileencoding= " defaults to latin1 otherwise, and converts bytes on read
set fileencodings= " defaults to "latin1,utf-8" otherwise...
Newer version of Vim (6+ perhaps) can automatically detect the correct syntax highlighting and indenting scheme that should be used for a file. Using the newer version of this (previously only file extensions were consulted) is a simple as putting the following command in your .vimrc:
filetype indent on " Newer indent features
4 pages link to .vimrc: