set nocompatible
filetype on
filetype plugin on
filetype indent on
" color
syntax on
colorscheme metacosm
set background=dark
set showmatch
" hightlight bad format
highlight BadFormat ctermbg=darkred guibg=darkred
match BadFormat /\s\+$\| \+\t\|\%>80v.\+/
" tabs
set tabstop=8
set shiftwidth=8
set softtabstop=8
set noexpandtab
set smarttab
set textwidth=80
set nowrap
" python specific
autocmd FileType python set expandtab tabstop=4 shiftwidth=4 softtabstop=4
let python_highlight_all=1
" indent
set autoindent
set smartindent
set cindent
" interface
ru mswin.vim
" show the cursor position at all times
set ruler
" show line numbers
set number
" xterm title
set title
" no beeps on error messages
set noerrorbells
" enable mouse usage (all modes) in terminals
set mouse=a
" font
set guifont=Terminus\ 14
" search
set incsearch
set nohlsearch
set ignorecase
set smartcase
set history=1000
" enable backspacing over everything
set backspace=2
set writeany
set autowriteall
" allow movement to another buffer without saving the current one
set hidden
" show an error window when there are errors
cwindow
" use the tab completion menu
set wildmenu
" file ecncoding
set fileencodings=utf-8,cp1251
" git grep
func GitGrep(...)
let save = &grepprg
set grepprg=git\ grep\ -n\ $*
let s = 'grep'
for i in a:000
let s = s . ' ' . i
endfor
exe s
let &grepprg = save
endfun
command -nargs=? G call GitGrep(<f-args>)
func GitGrepWord()
normal! "zyiw
call GitGrep('-w -e ', getreg('z'))
endf
" HOTKEYS
" git greep
nmap <F3> :call GitGrepWord()<CR>
imap <F3> <esc>:call GitGrepWord()<CR>i
" prev buffer
nmap <F4> :bp<cr>
imap <F4> <esc>:bp<cr>i
" next buffer
nmap <F5> :bn<cr>
imap <F5> <esc>:bn<cr>i
" make
nmap <F9> :make!<cr>
imap <F9> <esc>:make!<cr>i
" errors
nmap <F8> :copen<cr>
imap <F8> <esc>:copen<cr>i
" next
nmap <F7> :cn<cr>
imap <F7> <esc>:cn<cr>i
" prev
nmap <F6> :cp<cr>
imap <F6> <esc>:cp<cr>i
" file browse
nmap <F12> :Ex<cr>
imap <F12> <esc>:Ex<cr>i