I'm using Vim (and gVim) 7.4 on Windows and trying to use the following 
function to search for the visual selection:

function! s:VSetSearch(cmdtype)
  let temp = @s
  norm! gv"sy
  let @/ = '\V' . substitute(escape(@s, a:cmdtype.'\'), '\n', '\\n', 'g')
  let @s = temp
endfunction

xnoremap * :<C-u>call <SID>VSetSearch('/')<CR>/<C-R>=@/<CR><CR>
xnoremap # :<C-u>call <SID>VSetSearch('?')<CR>?<C-R>=@/<CR><CR>

With gVim the # mapping works fine but the * mapping doesn't exit visual 
selection (it extends the range of the visual selection until the next searched 
word). With (console) Vim none of the mappings work (to reproduce the problem 
in this last case, save the code snippet, download the MS Installer, open 
cmd.exe and start vim vim -u NONE, then do :set nocp and finally source the 
saved code). 

I reported this issue in Stack Overflow 
(http://stackoverflow.com/questions/18387991/vim-visual-star-search-not-working-as-expected)
 but (i) received no answer and (ii) another user was able to reproduce the 
problem (in console Vim). 

Along the way I realized that if try the following mappings

nnoremap * *<C-o>
nnoremap # #<C-o>

then once again: (i) in gVim the # mapping works fine and the * mapping doesn't 
and (ii) in console vim none of the mappings work. 

I don't know if this a bug or a problem with my setup (I'm relatively new to 
Vim) but any help will be greatly appreciated.

Thanks!

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui