The following can be placed in the file ~/.vimrc to set your favorite options when using Vim. This is not a complete listing, just those from my ~/vimrc.
General Options
| set nocompatible
|
get out of horrible vi-compatible mode.
|
| filetype on
|
detect the type of file being opened.
|
| set history=1000
|
set how many lines of history to remember.
|
| set cf
|
enable error files and error jumping.
|
| filetype plugin on
|
load filetype plugins.
|
| set viminfo+=!
|
make sure it can save viminfo.
|
| set isk+=_,$,@,%,#,-
|
none of these should be word dividers, so make them not be.
|
Theme and Colors
| set background=dark
|
use a dark background.
|
| syntax on
|
turn syntax highlighting on.
|
| colorscheme sean
|
set your color scheme.
|
Files and Backups
| set backup
|
make backup files.
|
| set backupdir=$HOME/vimfiles/backup
|
where to put those backup files.
|
| set directory=$HOME/vimfiles/temp
|
set the directory for temporary files.
|
| set makeef=error.err
|
when using make, where should it dump the file.
|
User Interface
| set ruler
|
show current positions along the bottom.
|
| set cmdheight=2
|
set the height of the command bar.
|
| set number
|
turn on line numbers.
|
| set lz
|
do not redraw while running macros (much faster) (LazyRedraw)
|
| set backspace=2
|
make backspace work normally.
|
| set mouse=a
|
use mouse everywhere.
|
| set report=0
|
tell us when anything is changed via :...
|
| set shortmess=atI
|
shortens messages to avoid 'press a key' prompt.
|
| set fillchars=vert:\ ,stl:\ ,stlnc:\
|
Visual Cues
| set showmatch
|
show matching brackets.
|
| set mat=50
|
how many tenths of a second to blink matching brackets.
|
| set lines=80
|
set height of workspace in lines.
|
| set columns=160
|
set width of workspace in columns.
|
| set so=10
|
keep 10 lines (top/bottom) for scope.
|
| set laststatus=2
|
always show the status line.
|
| set nohlsearch
|
do not highlight searched for phrases.
|
| set incsearch
|
BUT do highlight as you type you search phrase.
|
Text Formatting and Layout
| set ai
|
set auto indent.
|
| set si
|
set smart indent.
|
| set cindent
|
do c-style indenting.
|
| set tabstop=4
|
tab spacing (settings below are just to unify it)
|
| set softtabstop=4
|
| set shiftwidth=4
|
| set noexpandtab
|
use real tabs.
|
| set nowrap
|
do not wrap lines.
|
| set smarttab
|
use tabs at the start of a line, spaces elsewhere.
|
Folding
| set foldenable
|
turn on folding.
|
| set foldmethod=indent
|
make folding indent sensitive.
|
| set foldlevel=100
|
don't autofold anything, but enable fold manually.
|
| set foldopen-=search
|
don't open folds when you search into them.
|
| set foldopen-=undo
|
don't open folds when you undo stuff.
|
Autocommands
| autocmd BufEnter * :syntax sync fromstart
|
ensure every file does syntax highlighting
|