scriptencoding utf-8 " Use UTF-8 set encoding=utf-8 " Default encoding should always be UTF-8 set nocompatible " Don't emulate vi's limitations set tabstop=3 " Use 3 spaces for tabs set shiftwidth=3 " Use 3 spaces for next line indent set smarttab " Tab next line based on current line set expandtab " Use spaces for tabs set autoindent " Automatically indent next line if indented set smartindent " Indent next line based on current line set linebreak " Display long lines wrapped at word boundary set incsearch " Enable incremental search set ignorecase " Ignore case when searching set infercase " Try to figure out the case when searching set hlsearch " Highlight the search results set ve=block " Visual Edit Blocking set lazyredraw " Enable Lazy Redraw (faster macro execution) set showmode " Show the current mode set showmatch " Show matching brackets set mat=5 " Blink for 5 seconds set wildmenu " Enable wildmenu set wildmode=longest,full " Match the longest and full matches set scrolloff=3 " Show 3 lines of context on vertical scroll set sidescrolloff=2 " Show 2 columns of context on horizontal scroll set whichwrap+=<,>,h,l " Backspace and cursor keys wrap set backspace=2 " Normal backspace behavior set nonumber " Do not display line numbers set textwidth=80 " Break lines at 80 characters set showfulltag " Show full tags when doing completion if (v:version >= 700) set spell " Enable spell checking set spelllang=en_us " Spelling check language endif set title " Set a title on the terminal set laststatus=2 " Always display the status line set shortmess=atI " Enable short messages (press a key is annoying) set statusline=Editing:\ %r%t%m\ %=Location:\ Line\ %l/%L\ \ Col:\ %c\ (%p%%) set antialias " Antialias font rendering set lsp=0 " Increase spacing (easier to read) set hidden " Allow flipping of buffers without saving set magic " Regular expression characters have special meaning " Set a nice bright colorscheme if has("gui") colorscheme elflord " Set the colorscheme set background=light " We use a light background here else colorscheme zellner " Set the colorscheme set background=dark " We use a dark background here endif " Always ignore these files set wildignore=*.o,*~ if has("syntax") syntax on " Enable syntax highlighting endif if has("folding") set nofoldenable " Require user to fold set fillchars=fold:- " Fold characters should be - " If window is greater than 90 characters, set a column for folds if has("eval") fun! WideFold() if winwidth(0) > 90 setlocal foldcolumn=1 else setlocal foldcolumn=0 endif endfun if has("autocmd") autocmd BufEnter * :call WideFold() endif endif endif if has("eval") filetype on " Detect filetype by extension filetype indent on " Enable indents based on extensions filetype plugin on " Load filetype plugins endif " Try to get more fancy % matching if has("eval") runtime! macros/matchit.vim endif " Enable modelines only on secure vim if (v:version == 603 && has("patch045")) || (v:version > 603) set modeline else set nomodeline endif " Turn off search hilite when idle if has("autocmd") autocmd CursorHold * nohls | redraw endif " Always refresh syntax from the start if has("autocmd") autocmd BufEnter * syntax sync fromstart endif " Mutt does not like UTF-8 :-( if has("autocmd") autocmd BufRead,BufNewFile * \ if &ft == 'mail' | \ set fileencoding=iso8859-1 | \ endif endif " subversion commit messages need not be backed up if has("autocmd") autocmd BufRead svn-commit.tmp :setlocal nobackup endif " Detect procmail rules if has("autocmd") autocmd BufRead procmailrc :setfiletype procmail endif " Page using space noremap " Unhighlight on insert mode entry noremap i :nohlsi " Map F3 to nohls nmap :silent nohls imap :silent nohls " Map F12 to numbering nmap :silent set number! imap :silent set number! " Don't force Column 0 for # inoremap # X# " jj, oh you want to get out of edit mode inoremap jj " Map to indent code if has("autocmd") autocmd FileType c,cs,cpp,java nmap =0 endif " Disable case insensitivity if has("autocmd") autocmd BufEnter * \ if &filetype == 'c' || \ &filetype == 'cs' || \ &filetype == 'cpp' || \ &filetype == 'java' | \ set noignorecase noinfercase | \ endif endif " Show trailing whitespace visually " Shamelessly stolen from Ciaran McCreesh if (&termencoding == "utf-8") || has("gui_running") if v:version >= 700 set list listchars=tab:»·,trail:·,extends:…,nbsp:‗ else set list listchars=tab:»·,trail:·,extends:… endif else if v:version >= 700 set list listchars=tab:>-,trail:.,extends:>,nbsp:_ else set list listchars=tab:>-,trail:.,extends:> endif endif " tab completion " if has("eval") " function! CleverTab() " if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$' " return "\" " else " return "\" " endif " endfun " " inoremap =CleverTab() " endif " tab indents vmap >0 " shift-tab un-indents vmap <0 " ctrl-space for suggestions inoremap " Get rid of the annoying toolbar if has("gui_running") set guioptions=-m endif