set number
syntax on
set mouse=a
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
set colorcolumn=80
highlight colorcolumn ctermbg=green guibg=green
set hlsearch
nnoremap <F3> :noh<CR>
nnoremap <F4> :A<CR>

set nocompatible
set expandtab
set shiftwidth=2
set softtabstop=2
set smarttab
set tabstop=8

"plugin
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/syntastic.git'
Plugin 'myusuf3/numbers.vim'
call vundle#end()

let g:syntastic_c_compiler='clang'          " Use clang instead of gcc
let g:syntastic_c_compiler_options='-Wall -Wextra -pedantic -std=c99'
let g:syntastic_c_check_header=1            " Check headers in c
let g:syntastic_cpp_compiler='clang++'      " Use clang++ instead of g++
let g:syntastic_cpp_compiler_options='-Wall -Wextra -pedantic -std=c++11'
let g:syntastic_cpp_check_header=1          " Check headers in c++
let g:syntastic_ocaml_use_ocamlc=1          " Use ocamlc instead of ocamlopt

let g:numbers_exclude=[ 'nerdtree', 'undotree', 'diffpanel', 'tagbar' ]
filetype plugin indent on
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o

set relativenumber
set number
let mapleader=","
nnoremap <leader>n :NumbersToggle<CR>

inoremap <Nul> <C-n>
noremap <expr> <silent> <Home> col('.') == match(getline('.'),'\S')+1 ? '0' : '^'
imap <silent> <Home> <C-O><Home>