Skip to content

Commit

Permalink
Use keepalt for diff maps
Browse files Browse the repository at this point in the history
Resolves: tpope#2336
  • Loading branch information
tpope authored and jcarlos7121 committed Jan 31, 2025
1 parent 972bb7e commit 0f2d4f0
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 @@ -5036,19 +5036,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 @@ -8062,10 +8062,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 0f2d4f0

Please sign in to comment.