vim-signify/autoload/sy/jump.vim

30 lines
740 B
VimL
Raw Normal View History

2013-09-30 04:19:31 -04:00
" vim: et sw=2 sts=2
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')
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')
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