From 45fd3f4cb871a0edf582119f2db3e7d617dffb4f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 8 Jul 2019 09:55:25 -0400 Subject: [PATCH] Change interface for jumping directly to blame commit --- autoload/fugitive.vim | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 02b2393..47bc839 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4097,7 +4097,7 @@ augroup fugitive_blame autocmd FileType fugitiveblame setlocal nomodeline | if len(s:Dir()) | let &l:keywordprg = s:Keywordprg() | endif autocmd User Fugitive \ if get(b:, 'fugitive_type') =~# '^\%(file\|blob\|blame\)$' || filereadable(@%) | - \ exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:BlameCommand(,,+'',,0,'',,,[])" | + \ exe "command! -buffer -bar -bang -range=-1 -nargs=* Gblame :execute s:BlameCommand(,,+'',,0,'',,,[])" | \ endif autocmd ColorScheme,GUIEnter * call s:RehighlightBlame() autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('')), 'fugitive_leave') @@ -4127,8 +4127,8 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args) call s:throw('unsupported option') endif let cmd = ['--no-pager', 'blame', '--show-number'] - if a:count - let cmd += ['-L', a:line1 . ',' . a:line1] + if a:count > 0 + let cmd += ['-L', (a:line1 ? a:line1 : line('.')) . ',' . (a:line1 ? a:line1 : line('.'))] endif let cmd += a:args if s:DirCommitFile(@%)[1] =~# '\D\|..' @@ -4154,8 +4154,8 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args) if v:shell_error call s:throw(join(readfile(error),"\n")) endif - if a:count - let edit = s:Mods(a:mods) . get(['edit', 'split', 'pedit'], a:line2 - a:line1, ' split') + if a:count > 0 + let edit = s:Mods(a:mods) . get(['edit', 'split', 'pedit'], a:count - (a:line1 ? a:line1 : 1), 'split') return s:BlameCommit(edit, get(readfile(temp), 0, '')) else for winnr in range(winnr('$'),1,-1) @@ -4645,16 +4645,16 @@ endfunction function! fugitive#MapJumps(...) abort if !&modifiable if get(b:, 'fugitive_type', '') ==# 'blob' - nnoremap :.Gblame + nnoremap :0,3Gblame else nnoremap :exe GF("edit") endif if get(b:, 'fugitive_type', '') ==# 'blob' - nnoremap o :.,.+1Gblame + nnoremap o :0,2Gblame nnoremap S :echoerr 'Use gO' - nnoremap gO :vertical .,.+1Gblame - nnoremap O :tab .,.+1Gblame - nnoremap p :.,.+2Gblame + nnoremap gO :vertical 0,2Gblame + nnoremap O :tab 0,2Gblame + nnoremap p :0,3Gblame else nnoremap o :exe GF("split") nnoremap S :echoerr 'Use gO'