Plug 'scrooloose/syntastic'
Plug 'sgeb/vim-diff-fold'
Plug 'shougo/unite.vim'
-Plug 'shougo/vimproc.vim'
+Plug 'shougo/vimproc.vim', {'do': 'make'}
Plug 'sjl/gundo.vim'
Plug 'thinca/vim-qfreplace'
Plug 'tomtom/tcomment_vim'
map <space> <leader>
" make
-nnoremap <leader>r :make!<cr>
-nnoremap <leader><cr> :make!<cr>
+function! Make()
+ let l:make_dir = ""
+ if exists("b:make_dir")
+ let l:make_dir = "-C ".b:make_dir
+ elseif exists("g:make_dir")
+ let l:make_dir = "-C ".g:make_dir
+ endif
+
+ let l:make_targets = ""
+ if exists("g:make_targets")
+ let l:make_targets = g:make_targets
+ endif
+ execute "make! ".l:make_dir." ".l:make_targets
+endf
+nnoremap <leader>r :call Make()<cr>
" unhighlight search
nnoremap <silent> <Leader>/ :silent nohl<CR>
cnoremap <C-E> <End>
" proper movement when lines are wrapped
-noremap <expr> j (v:count == 0 ? 'gj' : 'j')
-noremap <expr> k (v:count == 0 ? 'gk' : 'k')
+noremap <silent><expr> j (v:count == 0 ? 'gj' : 'j')
+noremap <silent><expr> k (v:count == 0 ? 'gk' : 'k')
" disable arrows
noremap <Up> <NOP>