syn on
" Enable Ctrl+Backspace deleting the last word
imap <C-BS> <C-W>
set backspace=indent,eol,start  " more powerful backspacing

set nocompatible  " no vi compatible, seems to be good 
set expandtab     " covert TAB to spaces
set shiftwidth=2  " width of tabs
set softtabstop=2 " width of tabs

" Ctrl copy/cut paste behaviour
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <C-r><C-o>+

" Reformat shortcuts
nmap  <F1>  gqap    " re-format the current paragraph correctly
nmap  <F2>  gqqj    " format a line which is too long, and go to the next line
nmap  <F3>  kgqj    " merge the previous line with the current one, with a correct formatting
map!  <F1>  <ESC>gqapi
map!  <F2>  <ESC>gqqji
map!  <F3>  <ESC>kgqji

" Arrow left moves up line when at position 0
set whichwrap+=<,>,[,]


" ASTROID
autocmd BufRead /home/max/.cache/astroid/* :source ~/.vim/advanced.vim
autocmd BufRead /home/max/.cache/astroid/* :source ~/.vim/mail.vim
autocmd BufRead /home/max/.cache/astroid/* :source ~/.vim/astroid.vim

" Thunderbird
autocmd BufRead /tmp/*.eml :source ~/.vim/advanced.vim
autocmd BufRead /tmp/*.eml :source ~/.vim/mail.vim
