" Mappings
let mapleader=","
let g:mapleader=","

map <leader>rl :source $MYVIMRC<CR>
map <leader>ss :setlocal spell!<CR>
map <leader>ts :%s/\s\s*$//g<CR>
nnoremap <leader>rc :split $MYVIMRC<cr>
nnoremap <leader>p :set paste<cr>
nnoremap <leader>np :set nopaste<cr>
nnoremap <leader>nn :set nonumber norelativenumber<cr>
nnoremap <leader>rn :set number relativenumber<cr>

" commands
command! W  write
command! Q  qall!

" Vim Tabs
map <leader>tt :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>to :tabonly<cr>
map <leader>tn :tabNext<cr>
map <leader>tp :tabprevious<cr>
map <leader>tf :tabfirst<cr>
map <leader>tl :tablast<cr>
map <leader>tm :tabmove

" Basics
set encoding=utf-8

" General
" setlocal spell spelllang=en_us
set fileformats=unix,dos,mac
set nostartofline
set autochdir
set colorcolumn=81

" Have tab complete work more like bash
set wildmode=list:longest
set whichwrap+=<,>,[,]

" Turn on omni completion. Must have `filetype plugin on` to use.
" To use, in insert mode press ctrl+x ctrl+o
set omnifunc=syntaxcomplete#Complete
set completeopt=menu,longest,preview

" Indent
set smartindent
set copyindent
set preserveindent
set shiftround

" Text Formatting/Layout
set nowrap
set ignorecase
set smartcase
set list

" UI
set showcmd
set number
set relativenumber
set numberwidth=4
set hidden

" Cues
set showmatch
set matchtime=2
set hlsearch
set noerrorbells
set novisualbell
set t_vb=
set timeoutlen=500

" Tabs
set complete-=i
set autoindent
set backspace=indent,eol,start
set smarttab
set noexpandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4

set autoread

" Status
" ~/file [type] [line,column] [number of lines]
"set statusline=%F%m%r%h%w\ [%Y]\ [%03l,%03v]\ [%L]

set laststatus=2
set ruler
set wildmenu

set nrformats-=octal

set incsearch
set sessionoptions-=options
set viewoptions-=options

augroup COMMIT_EDITMSG
    autocmd!
    autocmd BufRead,BufNewFile COMMIT_EDITMSG set filetype=gitcommit
augroup END