" Vim settings
" General
set guifont=Courier_New:h14:cANSI
set nocompatible " We don't want vi compatibility.
filetype on " Automatically detect file types.
set cf " Enable error files & error jumping.
set clipboard+=unnamed " Yanks go on clipboard instead.
set history=1024 " Number of things to remember in history.
set autowrite " Writes on make/shell commands
set ruler " Ruler on
set nu " Line numbers on
set nowrap " Line wrapping off
set timeoutlen=100 " Time to wait after ESC (default causes annoying delay)
colorscheme darkblue " My color theme
" Backups & Files
set backup " Enable creation of backup file.
set backupdir=$VIM\.vim/backups " Where backups will go.
set directory=$VIM\.vim/tmp " Where temporary files will go.
" Formatting
set ts=4 " Tabs are 4 spaces
set bs=2 " Bs over everything in insert mode
set shiftwidth=4 " Tabs under smart indent
set nocp incsearch
set cinoptions=:0,p0,t0
set cinwords=if,else,while,do,for,switch,case
set formatoptions=tcqr
set cindent
set autoindent
set smarttab
" Visual
set showmatch " Show matching brackets.
set mat=5 " Bracket blinking.
set list
" Show $ at end of line, trailing space as ~
" but tab is seen fine..
set lcs=tab:\ \ ,eol:$,trail:~,extends:>,precedes:<
set novisualbell " No blinking .
set noerrorbells " No noise.
set laststatus=2 " Always show status line.
" gvim
set mousehide " Hide mouse after chars typed
set mouse=a " Mouse in all modes
" ctags
" TODO
" Mappings
" Surround line with /* */
map #2 :s:^\(.\+\)$:/* \1 */: <cr>
" Prefix line with //
map #3 :s:^\(.\+\)$:// \1: <cr>
" Remove prefixed '// '
map #4 :s:^[\t ]*//[ ]:: <cr>
" Abbreviations
ab _aBdate <c-r>=strftime('%a %D %r')<cr>
" Auto commands & anything language specific.
" All files
autocmd BufEnter * :lcd %:p:h
" C
autocmd BufRead *.c source $VIM\.vim/.vimrc.c
autocmd BufNewFile *.c source $VIM\.vim/.vimrc.c
autocmd BufNewFile *.c 0r $VIM\.vim/skeletons/skel.c
" C++
autocmd BufRead *.C,*.cc,*.cpp source $VIM\.vim/.vimrc.cpp
autocmd BufNewFile *.C,*.cc,*.cpp source $VIM\.vim/.vimrc.cpp
autocmd BufNewFile *.C,*.cc,*.cpp 0r $VIM\.vim/skeletons/skel.cpp
" perl
autocmd BufRead *.pl source $VIM\.vim/.vimrc.pl
autocmd BufNewFile *.pl source $VIM\.vim/.vimrc.pl
autocmd BufNewFile *.pl 0r $VIM\.vim/skeletons/skel.pl
let perl_extended_vars=1 " Highlight advanced vars inside strings
" PHP
autocmd BufRead *.php source $VIM\.vim/.vimrc.php
autocmd BufNewFile *.php source $VIM\.vim/.vimrc.php
autocmd BufNewFile *.php 0r $VIM\.vim/skeletons/skel.php
" Python
autocmd BufRead *.py source $VIM\.vim/.vimrc.py
autocmd BufNewFile *.py source $VIM\.vim/.vimrc.py
autocmd BufNewFile *.py 0r $VIM\.vim/skeletons/skel.py
" sh
autocmd BufRead *.sh source $VIM\.vim/.vimrc.sh
autocmd BufNewFIle *.sh source $VIM\.vim/.vimrc.sh
autocmd BufNewFile *.sh 0r $VIM\.vim/skeletons/skel.sh
syntax enable