Fix backward navigation from the middle of a line

Ensure backward searches don't match the current line. This shows up
more in neovim, which sets 'nostartofline' by default.
This commit is contained in:
yut23
2022-07-20 22:42:01 -04:00
committed by Tim Pope
parent 4e11f9dabf
commit 23b321b740

View File

@@ -4609,6 +4609,7 @@ function! s:NextHunk(count) abort
endfunction
function! s:PreviousHunk(count) abort
normal! 0
for i in range(a:count)
if &filetype ==# 'fugitive'
if getline('.') =~# '^@' && getline(line('.') - 1) =~# s:file_pattern
@@ -4638,6 +4639,7 @@ endfunction
function! s:PreviousFile(count) abort
exe s:StageInline('hide')
normal! 0
for i in range(a:count)
if !search(s:file_pattern, 'Wb')
break
@@ -4658,6 +4660,7 @@ function! s:NextItem(count) abort
endfunction
function! s:PreviousItem(count) abort
normal! 0
for i in range(a:count)
if !search(s:item_pattern, 'Wb') && getline('.') !~# s:item_pattern
call search('^commit ', 'Wb')
@@ -4693,6 +4696,7 @@ function! s:PreviousSection(count) abort
if getline('.') !~# '^commit '
-
endif
normal! 0
for i in range(a:count)
if !search(s:section_commit_pattern . '\|\%^', 'bW')
break