scriptencoding utf-8

filetype plugin indent on
filetype plugin on
syntax on
set ruler
set title
set number
set relativenumber
set hlsearch
set incsearch
set ignorecase smartcase
set omnifunc=syntaxcomplete#Complete
set background=light

set tabstop=4 softtabstop=4 shiftwidth=4
set backspace=eol,indent,start

set diffopt+=iwhite

colorscheme molokai
set colorcolumn=72

" I have never intended to use the builtin help
map <F1> <Esc>
imap <F1> <Esc>

" Paste using Ctrl+V in insert mode.
inoremap <C-v> <C-o>"+p

"language specific syntastic configurtion
"syntastic configuration
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_wq = 0

"vim-latex configuration
let g:Tex_CompileRule_pdf = "latexmk -pdflatex='pdflatex -file-line-error -synctex=1 -interaction=nonstopmode' $*"

" Remove trailing whitespace, always.
fun! StripTrailingWhitespace()
	" Skip files where the type is trailing space sensitive.
	if &ft =~ 'diff'
		return
	endif
	if expand("%:e") == 't'
		return
	endif
	%s/\s\+$//e
endfun

autocmd BufWritePre * call StripTrailingWhitespace()
autocmd filetype pkgbuild setlocal tabstop=2 shiftwidth=2 expandtab

" Keep backup files etc out of the way
set undofile
set undolevels=1000
set undoreload=10000
set undodir=~/.cache/vim/undo " vim will not create this directory.
set directory=~/.cache/vim/swap " vim will not create this directory.
set backupdir=~/.cache/vim/backup " vim will not create this directory.
set backup
set viminfo+=n~/.cache/vim/viminfo

" Death to the "Thanks for flying vim" message
set titleold=""

" Fix an issue with the indentLine plugin.
let g:indentLine_concealcursor='nc'

" Make sure we use the expected clipboard
set clipboard=unnamedplus

" Configure line breaking
set linebreak
set breakindent
set breakindentopt=min:0,shift:4,sbr
set showbreak=↳
