staz /.vimrc

" Vimrc of Olivier -Staz- Le Thanh Duong 

" Inspired from Dokuwiki developper's vimrc http://wiki.splitbrain.org/vimrc

"enable syntax highlighting
syntax on

" Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red guibg=red
match RedundantSpaces /\s\+$\| \+\ze\t\|\t/

" use 4 spaces instead of tabs
set tabstop=4
set shiftwidth=4
set expandtab

 " always show ^M in DOS files
set fileformats=unix

" my terminal is white on black
set background=dark
highlight Comment ctermbg=blue
highlight Comment ctermfg=white

" caseinsensitive incremental search
set ignorecase
set incsearch

" Show matching brackets
set showmatch

" always show line and col number and the current command
set ruler
set showcmd

"function to cleanup a text -> mapped to F5
fun CleanText()
     let curcol = col(".")
     let curline = line(".")
     exe ":retab"
     exe ":%s/
$//ge"
     exe ":%s/
/ /ge"
     exe ":%s/ \\+$//e"
     call cursor(curline, curcol)
endfun
map  :call CleanText()

set smarttab
set smartindent

colors evening
set scrolloff=4

" Taglist
nnoremap   :TlistToggle
let Tlist_GainFocus_On_ToggleOpen=1 

" turn spelling on and off. bang (!) toggles
map   ":silent setlocal spell! spelllang=en"
map   ":silent setlocal spell! spelllang=fr"

" Custom keymapping
map  :w:!scons
map  :w
map  :confirm q
noremap  gk
noremap  gj

"from tips 556
function! ShowDoc(name)
  vnew
  execute "read !pydoc " . a:name
  setlocal nomodifiable
  setlocal nomodified
  set filetype=man
  normal 1G
endfunction
map   +m :call ShowDoc("")