Skip to content

Commit

Permalink
Fix extra jump on star-search
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Aug 28, 2019
1 parent 0739436 commit 31aee09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/slash.vim
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ endfunction

function! s:immobile(seq)
let s:winline = winline()
let s:pos = getpos('.')
return a:seq."\<plug>(slash-prev)"
endfunction

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -102,7 +107,7 @@ endfunction
map <expr> <plug>(slash-trailer) <sid>trailer()
imap <expr> <plug>(slash-trailer) <sid>trailer_on_leave()
cnoremap <plug>(slash-cr) <cr>
noremap <plug>(slash-prev) ``
noremap <expr> <plug>(slash-prev) <sid>prev()
inoremap <plug>(slash-prev) <nop>
noremap! <plug>(slash-nop) <nop>
Expand Down

0 comments on commit 31aee09

Please sign in to comment.