2013-09-30 04:19:31 -04:00
|
|
|
" vim: et sw=2 sts=2
|
|
|
|
|
2013-08-19 11:36:16 -04:00
|
|
|
scriptencoding utf-8
|
|
|
|
|
2013-07-17 06:30:58 -04:00
|
|
|
" Function: #next_hunk {{{1
|
|
|
|
function! sy#jump#next_hunk(count)
|
2018-04-15 16:00:17 -04:00
|
|
|
execute sy#util#return_if_no_changes()
|
2013-07-17 06:30:58 -04:00
|
|
|
|
|
|
|
let lnum = line('.')
|
2013-11-21 20:57:43 -05:00
|
|
|
let hunks = filter(copy(b:sy.hunks), 'v:val.start > lnum')
|
2013-07-21 01:20:32 -04:00
|
|
|
let hunk = get(hunks, a:count - 1, get(hunks, -1, {}))
|
2013-07-17 06:30:58 -04:00
|
|
|
|
|
|
|
if !empty(hunk)
|
2013-11-21 20:57:43 -05:00
|
|
|
execute 'sign jump '. hunk.ids[0] .' buffer='. b:sy.buffer
|
2013-07-17 06:30:58 -04:00
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Function: #prev_hunk {{{1
|
|
|
|
function! sy#jump#prev_hunk(count)
|
2018-04-15 16:00:17 -04:00
|
|
|
execute sy#util#return_if_no_changes()
|
2013-07-17 06:30:58 -04:00
|
|
|
|
|
|
|
let lnum = line('.')
|
2013-11-21 20:57:43 -05:00
|
|
|
let hunks = filter(copy(b:sy.hunks), 'v:val.start < lnum')
|
2013-07-21 01:20:32 -04:00
|
|
|
let hunk = get(hunks, 0 - a:count, get(hunks, 0, {}))
|
2013-07-17 06:30:58 -04:00
|
|
|
|
|
|
|
if !empty(hunk)
|
2013-11-21 20:57:43 -05:00
|
|
|
execute 'sign jump '. hunk.ids[0] .' buffer='. b:sy.buffer
|
2013-07-17 06:30:58 -04:00
|
|
|
endif
|
|
|
|
endfunction
|