mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
@@ -47,9 +47,14 @@ endfunction
|
|||||||
function! gitgutter#hunk#next_hunk(count) abort
|
function! gitgutter#hunk#next_hunk(count) abort
|
||||||
let bufnr = bufnr('')
|
let bufnr = bufnr('')
|
||||||
if gitgutter#utility#is_active(bufnr)
|
if gitgutter#utility#is_active(bufnr)
|
||||||
|
let hunks = gitgutter#hunk#hunks(bufnr)
|
||||||
|
if empty(hunks)
|
||||||
|
call gitgutter#utility#warn('No hunks in file')
|
||||||
|
return
|
||||||
|
endif
|
||||||
let current_line = line('.')
|
let current_line = line('.')
|
||||||
let hunk_count = 0
|
let hunk_count = 0
|
||||||
for hunk in gitgutter#hunk#hunks(bufnr)
|
for hunk in hunks
|
||||||
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
|
||||||
@@ -65,9 +70,14 @@ endfunction
|
|||||||
function! gitgutter#hunk#prev_hunk(count) abort
|
function! gitgutter#hunk#prev_hunk(count) abort
|
||||||
let bufnr = bufnr('')
|
let bufnr = bufnr('')
|
||||||
if gitgutter#utility#is_active(bufnr)
|
if gitgutter#utility#is_active(bufnr)
|
||||||
|
let hunks = gitgutter#hunk#hunks(bufnr)
|
||||||
|
if empty(hunks)
|
||||||
|
call gitgutter#utility#warn('No hunks in file')
|
||||||
|
return
|
||||||
|
endif
|
||||||
let current_line = line('.')
|
let current_line = line('.')
|
||||||
let hunk_count = 0
|
let hunk_count = 0
|
||||||
for hunk in reverse(copy(gitgutter#hunk#hunks(bufnr)))
|
for hunk in reverse(copy(hunks))
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user