~ krc /.vimrc

My .vimrc One of my most valued dotfiles, along with my bash setup.
set encoding=utf-8        " Use UTF-8   Go Unicode!
set showmode                " always show current mode
set magic                " extended regexps - use \v for very-magic

" tell vim to shut up
set noerrorbells        " Doesn't work, maybe needed for next part?
set visualbell                " use screen flash instead of bells
set t_vb=                " set screen flash control char to nothing

" some options for gvim
set guifont=dejavu\ sans\ mono\ 10
highlight Normal guibg=black guifg=lightgrey

" set Ctrl-n and Ctrl-p to next and previous buffer
nnoremap <silent> <C-n> "<Esc>:silent bnext<CR>"
nnoremap <silent> <C-p> "<Esc>:silent bprevious<CR>"

" turn spelling on and off. bang (!) toggles
map <silent> <F5> "<Esc>:silent setlocal spell!<CR>"

" paste mode
set pastetoggle=<F6>  

" make home and end work
map <HOME> ^
map <END> $


" syntax related. background=dark makes the syntax colorizer use colors
" appropriate for a dark background
set background=dark
syntax enable

" 1 <tab> = 4 spaces, 2 <tab>s = 1 tab (size of 8 spaces)
set tabstop=8
set shiftwidth=4
set softtabstop=4

" Shift-Tab inserts a real tab
" inoremap <S-Tab> <C-V><Tab>

" use elinks to view current file - broken, how to fix?
map <F2> :!elinks file://%<CR>
command View :!elinks file://% 


" enable markdown markdown detection and syntax plugin 
augroup mkd
    autocmd BufRead *.mkd  set ai formatoptions=tcroqn2 comments=n:>
augroup END

" enable reading of doc, pdf, ps and odt in vim based on extension
autocmd BufReadPre *.pdf set ro
autocmd BufReadPost *.pdf silent %!pdftotext -nopgbrk "%" - |fmt -csw78

autocmd BufReadPre *.ps set ro
autocmd BufReadPost *.ps silent %!pdftotext -nopgbrk "%" - |fmt -csw78

autocmd BufReadPre *.doc set ro
autocmd BufReadPost *.doc silent %!antiword "%" 

autocmd BufReadPre *.odt set ro
autocmd BufReadPost *.odt silent %!odt2txt "%"