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)
|
|
|
|
if !has_key(g:sy, g:sy_path)
|
|
|
|
echomsg 'signify: I cannot detect any changes!'
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
let lnum = line('.')
|
|
|
|
let hunks = filter(copy(g:sy[g:sy_path].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)
|
|
|
|
execute 'sign jump '. hunk.ids[0] .' file='. g:sy_path
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Function: #prev_hunk {{{1
|
|
|
|
function! sy#jump#prev_hunk(count)
|
|
|
|
if !has_key(g:sy, g:sy_path)
|
|
|
|
echomsg 'signify: I cannot detect any changes!'
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
let lnum = line('.')
|
|
|
|
let hunks = filter(copy(g:sy[g:sy_path].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)
|
|
|
|
execute 'sign jump '. hunk.ids[0] .' file='. g:sy_path
|
|
|
|
endif
|
|
|
|
endfunction
|