From ac01d7a97118519f49221a49cc25640b2aba7cc8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 1 Feb 2020 12:35:46 +0100 Subject: Draft version of searching for what was selected by a motion Currently doesn't highlight correctly. Only works in normal mode for now. Overwrites the unnamed register. Inspired by https://github.com/godlygeek/vim-files/blob/8714546/plugin/vsearch.vim --- plugin/searchop.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugin/searchop.vim 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 a :set opfunc=Searchg@ +vnoremap a :call Search(visualmode(), 1) + + +function! Search(type, ...) + silent execute "normal! `[v`]y" + + let @/ = escape(@@, '\') + call histadd('/', @/) + normal! n +endfunction -- cgit v1.2.3