File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ function! sy#jump#next_hunk(count)
1313 if ! empty (hunk)
1414 execute ' sign jump ' . hunk.ids[0 ] .' buffer=' . b: sy .buffer
1515 endif
16+
17+ if exists (' #User#SignifyHunk' )
18+ doautocmd <nomodeline> User SignifyHunk
19+ endif
1620endfunction
1721
1822" #prev_hunk {{{1
@@ -26,4 +30,8 @@ function! sy#jump#prev_hunk(count)
2630 if ! empty (hunk)
2731 execute ' sign jump ' . hunk.ids[0 ] .' buffer=' . b: sy .buffer
2832 endif
33+
34+ if exists (' #User#SignifyHunk' )
35+ doautocmd <nomodeline> User SignifyHunk
36+ endif
2937endfunction
Original file line number Diff line number Diff line change @@ -115,6 +115,22 @@ endfunction
115115
116116let s: popup_window = 0
117117
118+ " #get_hunk_stats {{{1
119+ function ! sy#util#get_hunk_stats () abort
120+ execute sy#util#return_if_no_changes ()
121+
122+ let curline = line (' .' )
123+ let total_hunks = len (b: sy .hunks)
124+
125+ for i in range (total_hunks)
126+ if b: sy .hunks[i ].start <= curline && b: sy .hunks[i ].end >= curline
127+ return { ' total_hunks' : total_hunks, ' current_hunk' : i + 1 }
128+ endif
129+ endfor
130+
131+ return {}
132+ endfunction
133+
118134" #popup_close {{{1
119135function ! sy#util#popup_close () abort
120136 if s: popup_window
Original file line number Diff line number Diff line change @@ -520,6 +520,17 @@ Mapping other keys:
520520 nmap <leader>gJ 9999<leader>gj
521521 nmap <leader>gK 9999<leader>gk
522522<
523+ When you jump to a hunk, show "[Hunk 2/15]" by putting this in your vimrc:
524+ >
525+ autocmd User SignifyHunk call s:show_current_hunk()
526+
527+ function! s:show_current_hunk() abort
528+ let h = sy#util#get_hunk_stats()
529+ if !empty(h)
530+ echo printf('[Hunk %d/%d]', h.current_hunk, h.total_hunks)
531+ endif
532+ endfunction
533+ <
523534------------------------------------------------------------------------------
524535Hunk text object:~
525536>
You can’t perform that action at this time.
0 commit comments