Restore blamed window on gq in blame

This commit is contained in:
Tim Pope 2011-10-01 04:13:09 -04:00
parent a23dcec3d2
commit 59ce7a9e19
2 changed files with 4 additions and 1 deletions

View File

@ -171,7 +171,9 @@ that are part of Git repositories).
to reblame at that commit's [count]th parent (like
HEAD^[count]). Press o or O to open up that commit
in a horizontal of vertical split. Pressing q will
close the blame buffer.
close the blame buffer, and pressing gq will close the
blame buffer and return the targeted window to the
work tree version.
:[range]Gblame [flags] Run git-blame on the given range.

View File

@ -1484,6 +1484,7 @@ function! s:Blame(bang,line1,line2,count,args) abort
setlocal norelativenumber
endif
nnoremap <buffer> <silent> q :exe substitute('bdelete<Bar>'.bufwinnr(b:fugitive_blamed_bufnr).' wincmd w','<Bar>-1','','')<CR>
nnoremap <buffer> <silent> gq :exe substitute('bdelete<Bar>'.bufwinnr(b:fugitive_blamed_bufnr).' wincmd w<Bar>if expand("%:p") =~# "^fugitive:[\\/][\\/]"<Bar>Gedit<Bar>endif','<Bar>-1','','')<CR>
nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>BlameJump('')<CR>
nnoremap <buffer> <silent> P :<C-U>exe <SID>BlameJump('^'.v:count1)<CR>
nnoremap <buffer> <silent> ~ :<C-U>exe <SID>BlameJump('~'.v:count1)<CR>