diff options
| author | Teddy Wing | 2020-02-05 01:03:52 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2020-02-05 01:03:52 +0100 | 
| commit | b49d25965be039a932264d7e954837405f60d8c9 (patch) | |
| tree | b0ddf26078628ac139dc526b741b809ccb8cfda4 | |
| parent | 6c24e799067121a417dd79c9ba5415ae82cda145 (diff) | |
| download | vim-searchop-b49d25965be039a932264d7e954837405f60d8c9.tar.bz2 | |
Search(): Support visual mode and line-oriented
Escape newlines so that multiline search works.
| -rw-r--r-- | plugin/searchop.vim | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/plugin/searchop.vim b/plugin/searchop.vim index a795234..ecfe2a1 100644 --- a/plugin/searchop.vim +++ b/plugin/searchop.vim @@ -5,9 +5,15 @@ vnoremap <silent> z/ :<C-u>call Search(visualmode(), 1)<CR>  function! Search(type, ...)  	let user_unnamed_register = @@ -	silent execute "normal! `[v`]y" +	if a:0 +		silent execute "normal! gvy" +	elseif a:type == 'line' +		silent execute "normal! '[V']y" +	else +		silent execute "normal! `[v`]y" +	endif -	let @/ = escape(@@, '\') +	let @/ = substitute(escape(@@, '\'), '\n', '\\n', 'g')  	call histadd('/', @/)  	call feedkeys('n', 't') | 
