Skip to content

Commit

Permalink
Update open preview on hunk jump
Browse files Browse the repository at this point in the history
  • Loading branch information
airblade committed Apr 22, 2021
1 parent e288dd4 commit 66bafa5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions autoload/gitgutter/hunk.vim
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ function! gitgutter#hunk#next_hunk(count) abort
if g:gitgutter_show_msg_on_hunk_jumping
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
endif
if s:is_preview_window_open()
call gitgutter#hunk#preview()
endif
return
endif
endif
Expand Down Expand Up @@ -92,6 +95,9 @@ function! gitgutter#hunk#prev_hunk(count) abort
if g:gitgutter_show_msg_on_hunk_jumping
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
endif
if s:is_preview_window_open()
call gitgutter#hunk#preview()
endif
return
endif
endif
Expand Down Expand Up @@ -593,3 +599,14 @@ function! s:close_hunk_preview_window()
let s:winid = 0
let s:preview_bufnr = 0
endfunction


" Only makes sense for traditional, non-floating preview window.
function s:is_preview_window_open()
for i in range(1, winnr('$'))
if getwinvar(i, '&previewwindow') == 1
return 1
endif
endfor
return 0
endfunction

0 comments on commit 66bafa5

Please sign in to comment.