nnoremap <Leader>ga :Git add %<CR>
nnoremap <Leader>gA :Git reset HEAD %<CR>
xnoremap <Leader>gb :Git blame<CR>
nnoremap <Leader>gb :Git branch -a<CR>
nnoremap <Leader>gB :Git branch<SPACE>
nnoremap <Leader>gc :Git checkout -b<SPACE>
nnoremap <Leader>gC :Git checkout<SPACE>
nnoremap <Leader>gd :Ghdiffsplit!<CR>
nnoremap <Leader>gD :Gvdiffsplit!<CR>
nnoremap <Leader>ge :sp<CR>:Gedit HEAD~:%<Left><Left>
nnoremap <Leader>gE :sp<CR>:Gedit :%:p<Left><Left><Left><Left>
nnoremap <Leader>gf :Git fetch --all<CR>
nnoremap <Leader>gF :call git#git_fetch_origin_merge()<CR>
nnoremap <Leader>gl :Git log --stat %<CR>
nnoremap <Leader>gL :Git log --stat -n 100<CR>
xnoremap <Leader>gl :<C-U>call git#git_log_range()<CR>
xnoremap <Leader>gL :call git#git_log_named_block()<CR>
nnoremap <Leader>gM :call git#git_merge_origin()<CR>
nnoremap <Leader>go :call git#git_log_compare()<CR>
nnoremap <Leader>gp :Git push<CR>
nnoremap <Leader>gP :Git push -u<SPACE>
nnoremap <Leader>gr :call git#git_rebase_origin()<CR>
nnoremap <Leader>gR :Git rebase --abort<CR>
nnoremap <Leader>g- :Git stash<CR>:e<CR>
nnoremap <Leader>g+ :Git stash pop<CR>:e<CR>
nnoremap <Leader>gs :Git<CR>
nnoremap <Leader>gS :Git stash -- %<CR>
nnoremap <Leader>gw :Gwrite<CR>
nnoremap <Leader>G  :Git<SPACE>

augroup custom_fugitive
  autocmd!
  autocmd FileType fugitive nnoremap <buffer><silent> q :bwipeout!<CR>
  autocmd BufReadPost fugitive:// setlocal bufhidden=wipe
augroup END
