" vim: syntax=vim

syntax on
"set nu
set backspace=2

set omnifunc=haskellcomplete#CompleteHaskell
set autoindent
"set tabstop=2
set shiftwidth=2
set expandtab

set nocompatible " allow not-in-vi features
"set modeline
set hlsearch " highlight search matches
set incsearch " incremental search on
"set scrolloff=5 " minimally show N lines below/above cursor
set tabstop=4 " set tabstop to 4
set softtabstop=2 " set tabstop to 4
"set expandtab
"set autoindent " use autoindent
set shiftwidth=4 " autoindenter 'indent level' width
"set textwidth=78 " break lines at char 79 automatically
"set backspace=indent,eol,start " allow backspacing end of line
set history=120 " save last 120 commands in history
"set backup " create autobackups
set ruler " show status line on last line
"set showcmd " display keys as pressed in normal mode
set linebreak " break long lines when displaying
set restorescreen " restore screen state after exit
"set ttyfast " we have fast terminal
"set foldcolumn=3 " create fold-open markers on left
set number " show line numbers on left
set whichwrap=b,s,[,],<,>,h,l " allow cursor keys to move over line-ends
let c_space_errors=1
set tabpagemax=100 " do not limit number of tabs significantly

"latex:
filetype plugin indent on
set grepprg=grep\ -nH\ $*
let g:tex_flavor = "latex"

"spellcheck LaTeX
autocmd FileType tex setlocal spell spelllang=en_us,cs
autocmd FileType mdwn setlocal spell spelllang=en_us,cs
autocmd FileType tmdwn setlocal spell spelllang=en_us,cs

" more bash-like tab completion
set wildmode=longest,list,full
set wildmenu

highlight ExtraWhitespace ctermbg=red guibg=red
" Show trailing whitespace and spaces before a tab:
match ExtraWhitespace /\s\+$\| \+\ze\t/

map <F6> :!make all
map <F7> :!autocompile %
map <F8> :!make all >& /dev/null &

augroup pandoc_syntax
    au! BufNewFile,BufFilePRe,BufRead *.md set filetype=markdown.pandoc
augroup END

set mouse=a
