crox /.vimrc

set nocompatible

syntax on
set nu

set shiftwidth=4
set softtabstop=4
set expandtab 

filetype on 
filetype plugin on
filetype indent on

let g:load_doxygen_syntax=1

set backspace=2

" nice search
set incsearch
set nohlsearch

set showcmd
set ruler
set mouse=a
if $TERM =~ '^screen' && exists("+ttymouse") && &ttymouse == ''
    set ttymouse=xterm
endif

" russian keymap
" set keymap=russian-jcuken
" set iminsert=0

" it's dangerous
set autowrite

" some C abbreviations
ab #d #define
ab #i #include
ab #e #endif
ab /*** /******************************************************************************/

set tags+=$ENV_PATH/.tagsfile
set path=.,..,$ENV_PATH/*,$ENV_PATH,/usr/include/,/usr/include/*

let Tlist_GainFocus_On_ToggleOpen = 1

" cycle through errors
map <F3> :cn <Enter> 
" open Taglist
map <silent> <F4> :TlistToggle <CR> <C-W>L :wincmd h <CR> :vertical resize 80 <CR> 

function! OnlineDoc()
    if &ft =~ "cpp"
        let s:urlTemplate = "http://doc.trolltech.com/4.4/%.html"
    elseif &ft =~ "python"
        let s:urlTemplate = "http://riverbankcomputing.co.uk/static/Docs/PyQt4/html/%.html"
    elseif &ft =~ "ruby"
        let s:urlTemplate = "http://www.ruby-doc.org/core/classes/%.html"
    elseif &ft =~ "perl"
        let s:urlTemplate = "http://perldoc.perl.org/functions/%.html "
    else
        return
    endif

    let s:browser = "firefox"
    let s:wordUnderCursor = expand("<cword>")
    let s:url = substitute(s:urlTemplate, "%", s:wordUnderCursor, "g")

    let s:cmd = "silent !" . s:browser . " " . s:url . "&"
    execute  s:cmd
endfunction

" online doc search
map <silent> <F1> :call OnlineDoc()<CR>

if has("autocmd")
  autocmd FileType python set complete+=k~/.vim/pydiction iskeyword+=.,(
endif " has("autocmd")