mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Respect &foldopen during next/prev hunk jumps
This commit is contained in:
@@ -60,7 +60,8 @@ function! gitgutter#hunk#next_hunk(count) abort
|
|||||||
if hunk[2] > current_line
|
if hunk[2] > current_line
|
||||||
let hunk_count += 1
|
let hunk_count += 1
|
||||||
if hunk_count == a:count
|
if hunk_count == a:count
|
||||||
execute 'normal!' hunk[2] . 'Gzv'
|
let keys = &foldopen =~# '\<block\>' ? 'zv' : ''
|
||||||
|
execute 'normal!' hunk[2] . 'G' . keys
|
||||||
if g:gitgutter_show_msg_on_hunk_jumping
|
if g:gitgutter_show_msg_on_hunk_jumping
|
||||||
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
|
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
|
||||||
endif
|
endif
|
||||||
@@ -90,8 +91,9 @@ function! gitgutter#hunk#prev_hunk(count) abort
|
|||||||
if hunk[2] < current_line
|
if hunk[2] < current_line
|
||||||
let hunk_count += 1
|
let hunk_count += 1
|
||||||
if hunk_count == a:count
|
if hunk_count == a:count
|
||||||
|
let keys = &foldopen =~# '\<block\>' ? 'zv' : ''
|
||||||
let target = hunk[2] == 0 ? 1 : hunk[2]
|
let target = hunk[2] == 0 ? 1 : hunk[2]
|
||||||
execute 'normal!' target . 'Gzv'
|
execute 'normal!' target . 'G' . keys
|
||||||
if g:gitgutter_show_msg_on_hunk_jumping
|
if g:gitgutter_show_msg_on_hunk_jumping
|
||||||
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
|
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user