From 31aee09b7ea8893a18fa34f65e63e364fc998444 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 28 Aug 2019 16:52:47 +0900 Subject: [PATCH] Fix extra jump on star-search Fix #21 --- plugin/slash.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/slash.vim b/plugin/slash.vim index f67fb99..a96aa44 100644 --- a/plugin/slash.vim +++ b/plugin/slash.vim @@ -31,6 +31,7 @@ endfunction function! s:immobile(seq) let s:winline = winline() + let s:pos = getpos('.') return a:seq."\(slash-prev)" endfunction @@ -62,6 +63,10 @@ function! s:trailer_on_leave() return '' endfunction +function! s:prev() + return getpos('.') == s:pos ? '' : '``' +endfunction + function! s:escape(backward) return '\V'.substitute(escape(@", '\' . (a:backward ? '?' : '/')), "\n", '\\n', 'g') endfunction @@ -102,7 +107,7 @@ endfunction map (slash-trailer) trailer() imap (slash-trailer) trailer_on_leave() cnoremap (slash-cr) -noremap (slash-prev) `` +noremap (slash-prev) prev() inoremap (slash-prev) noremap! (slash-nop)