" vsearch.vim " Visual mode search " Copied from https://github.com/godlygeek/vim-files/blob/master/plugin/vsearch.vim function! s:VSetSearch() let temp = @@ norm! gvy let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') " Use this line instead of the above to match matches spanning across lines "let @/ = '\V' . substitute(escape(@@, '\'), '\_s\+', '\\_s\\+', 'g') call histadd('/', substitute(@/, '[?/]', '\="\\%d".char2nr(submatch(0))', 'g')) let @@ = temp endfunction vnoremap * :call VSetSearch()/ vnoremap # :call VSetSearch()?