Skip to content

Commit

Permalink
Use keepalt for diff maps
Browse files Browse the repository at this point in the history
Resolves: #2336
  • Loading branch information
tpope committed Sep 7, 2024
1 parent 1d18c69 commit d4877e5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions autoload/fugitive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4986,19 +4986,19 @@ function! s:StageDiff(diff) abort
return 'Git --paginate diff --no-ext-diff'
elseif len(info.paths) > 1
execute 'Gedit' . prefix s:fnameescape(':0:' . info.paths[0])
return a:diff . '! @:'.s:fnameescape(info.paths[1])
return 'keepalt ' . a:diff . '! @:'.s:fnameescape(info.paths[1])
elseif info.section ==# 'Staged' && info.sigil ==# '-'
execute 'Gedit' prefix s:fnameescape(':0:'.info.paths[0])
return a:diff . '! :0:%'
return 'keepalt ' . a:diff . '! :0:%'
elseif info.section ==# 'Staged'
execute 'Gedit' prefix s:fnameescape(':0:'.info.paths[0])
return a:diff . '! @:%'
return 'keepalt ' . a:diff . '! @:%'
elseif info.sigil ==# '-'
execute 'Gedit' prefix s:fnameescape(':0:'.info.paths[0])
return a:diff . '! :(top)%'
return 'keepalt ' . a:diff . '! :(top)%'
else
execute 'Gedit' prefix s:fnameescape(':(top)'.info.paths[0])
return a:diff . '!'
return 'keepalt ' . a:diff . '!'
endif
endfunction

Expand Down Expand Up @@ -7995,10 +7995,10 @@ function! fugitive#MapJumps(...) abort
endif

call s:Map('n', 'D', ":echoerr 'fugitive: D has been removed in favor of dd'<CR>", '<silent><unique>')
call s:Map('n', 'dd', ":<C-U>call fugitive#DiffClose()<Bar>Gdiffsplit!<CR>", '<silent>')
call s:Map('n', 'dh', ":<C-U>call fugitive#DiffClose()<Bar>Ghdiffsplit!<CR>", '<silent>')
call s:Map('n', 'ds', ":<C-U>call fugitive#DiffClose()<Bar>Ghdiffsplit!<CR>", '<silent>')
call s:Map('n', 'dv', ":<C-U>call fugitive#DiffClose()<Bar>Gvdiffsplit!<CR>", '<silent>')
call s:Map('n', 'dd', ":<C-U>call fugitive#DiffClose()<Bar>keepalt Gdiffsplit!<CR>", '<silent>')
call s:Map('n', 'dh', ":<C-U>call fugitive#DiffClose()<Bar>keepalt Ghdiffsplit!<CR>", '<silent>')
call s:Map('n', 'ds', ":<C-U>call fugitive#DiffClose()<Bar>keepalt Ghdiffsplit!<CR>", '<silent>')
call s:Map('n', 'dv', ":<C-U>call fugitive#DiffClose()<Bar>keepalt Gvdiffsplit!<CR>", '<silent>')
call s:Map('n', 'd?', ":<C-U>help fugitive_d<CR>", '<silent>')

else
Expand Down

0 comments on commit d4877e5

Please sign in to comment.