diff options
| author | Teddy Wing | 2020-02-05 00:06:50 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2020-02-05 00:06:50 +0100 | 
| commit | 6c24e799067121a417dd79c9ba5415ae82cda145 (patch) | |
| tree | b2e7b605f702929e5c6f78962a65ff572e0317b3 | |
| parent | 52f545dca74adedf5b1d88295749c91e0821647b (diff) | |
| download | vim-searchop-6c24e799067121a417dd79c9ba5415ae82cda145.tar.bz2 | |
Search(): Don't overwrite the unnamed register
| -rw-r--r-- | plugin/searchop.vim | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/plugin/searchop.vim b/plugin/searchop.vim index 8a24ede..a795234 100644 --- a/plugin/searchop.vim +++ b/plugin/searchop.vim @@ -3,10 +3,14 @@ vnoremap <silent> z/ :<C-u>call Search(visualmode(), 1)<CR>  function! Search(type, ...) +	let user_unnamed_register = @@ +  	silent execute "normal! `[v`]y"  	let @/ = escape(@@, '\')  	call histadd('/', @/)  	call feedkeys('n', 't') + +	let @@ = user_unnamed_register  endfunction | 
