From 95aea6b533e71e478d61d18fac71cca116c56a4d Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sun, 22 May 2022 22:47:23 +0100 Subject: Add all the plugins I currently use --- start/signify/autoload/sy/jump.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 start/signify/autoload/sy/jump.vim (limited to 'start/signify/autoload/sy/jump.vim') diff --git a/start/signify/autoload/sy/jump.vim b/start/signify/autoload/sy/jump.vim new file mode 100644 index 0000000..69756b1 --- /dev/null +++ b/start/signify/autoload/sy/jump.vim @@ -0,0 +1,29 @@ +" vim: et sw=2 sts=2 + +scriptencoding utf-8 + +" Function: #next_hunk {{{1 +function! sy#jump#next_hunk(count) + execute sy#util#return_if_no_changes() + + let lnum = line('.') + let hunks = filter(copy(b:sy.hunks), 'v:val.start > lnum') + let hunk = get(hunks, a:count - 1, get(hunks, -1, {})) + + if !empty(hunk) + execute 'sign jump '. hunk.ids[0] .' buffer='. b:sy.buffer + endif +endfunction + +" Function: #prev_hunk {{{1 +function! sy#jump#prev_hunk(count) + execute sy#util#return_if_no_changes() + + let lnum = line('.') + let hunks = filter(copy(b:sy.hunks), 'v:val.start < lnum') + let hunk = get(hunks, 0 - a:count, get(hunks, 0, {})) + + if !empty(hunk) + execute 'sign jump '. hunk.ids[0] .' buffer='. b:sy.buffer + endif +endfunction -- cgit v1.2.3