+
+" Use 'noignorecase' for * and #. See comment in s:VSetSearch() for details.
+" Thanks to the writers of s:VSetSearch(), see above.
+ function! s:NSetSearch()
+ let l:cword = expand('<cword>')
+ let l:regex = substitute(escape(l:cword, '\'), '\n', '\\n', 'g')
+ let @/ = '\C\V'. '\<' . l:regex . '\>'
+ endfunction
+ nnoremap * :call <SID>NSetSearch()<CR>//<CR>
+ nnoremap # :call <SID>NSetSearch()<CR>??<CR>