vimrc

" Set settings
set autoindent
set title
"set notitle
set ruler
set nocompatible
set showcmd
set ts=2
set shiftwidth=2
set expandtab
set shiftround
set smarttab
set tw=72
set backspace=indent,eol,start
set incsearch
set showmatch
set pastetoggle=<F11>
filetype plugin on
syntax on
colors ron
let mapleader=","

" Remember where I last edited a file
set viminfo='10,"100,:20,%,n~/.viminfo
    au BufReadPost * if line("'"") > 0|if line("'"") <= line("$")|exe("norm '"")|else|exe "norm $"|endif|endif

if &term =~ "xterm-debian" || &term =~ "xterm-xfree86" || &term =~ "Eterm"
  set t_Co=16
  set t_Sf=^[[3%dm
  set t_Sb=^[[4%dm
endif
" Settings set

" Map mappings
:inoremap ( ()<ESC>i
:inoremap [ []<ESC>i
:inoremap " ""<ESC>i
:inoremap { {}<ESC>i
:inoremap < <><ESC>i

"map W :!aspell -c -x % " old - vim7 has spellcheck now
map F gqap

" http://vim.sourceforge.net/tips/tip.php?tip_id=465
" make an element out of anything you type with a CR in the middle
inoremap ,,, <esc>diwi<<esc>pa><cr></<esc>pa><esc>kA

" Fix common typos
iab teh the
iab hte the
iab adn and
iab nad and
iab taht that
iab htat that
iab fo of
iab ot to
iab wiht with

set pastetoggle=<F10>

" SmartTab wrapper
function! SmartTab()
  let col = col('.') - 1
  if !col || getline('.')[col - 1] !~ 'k'
    return "<tab>"
  else
    return "<c-p>"
  endif
endfunction

" turn on SmartTabs
inoremap <tab> <c-r>=SmartTab()<cr>

" Turn on the spellcheck
setlocal spell spelllang=en_us
set spellfile=~/.vimspell.utf8.add

" Mappings mapped

" Language-specific skeleton files
" Perl
autocmd BufNewFile *.pl 0r ~/.vim/skel/skel.pl
" HTML
autocmd BufNewFile *.html 0r ~/.vim/skel/skel.html
" Python
autocmd BufNewFile *.py 0r ~/.vim/skel/skel.py