diff options
-rw-r--r-- | plugin/searchop.vim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugin/searchop.vim b/plugin/searchop.vim new file mode 100644 index 0000000..6757dcf --- /dev/null +++ b/plugin/searchop.vim @@ -0,0 +1,11 @@ +nnoremap <silent> <leader>a :set opfunc=Search<CR>g@ +vnoremap <silent> <leader>a :<C-u>call Search(visualmode(), 1)<CR> + + +function! Search(type, ...) + silent execute "normal! `[v`]y" + + let @/ = escape(@@, '\') + call histadd('/', @/) + normal! n +endfunction |