From 4e11f9dabfa5441798b5d6af1c2d22087db13e9d Mon Sep 17 00:00:00 2001 From: yut23 Date: Wed, 20 Jul 2022 22:37:21 -0400 Subject: [PATCH] Fix `[c` from the first hunk of a file This makes the rest of the function operate on the previous file rather than the file of the hunk under the cursor. --- autoload/fugitive.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 12047f8..55942a4 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4611,6 +4611,9 @@ endfunction function! s:PreviousHunk(count) abort for i in range(a:count) if &filetype ==# 'fugitive' + if getline('.') =~# '^@' && getline(line('.') - 1) =~# s:file_pattern + - + endif let lnum = search(s:file_pattern . '\|^@','Wbn') call s:StageInline('show', lnum) call search('^? .\|^@','Wb')