From: Simon Ruderich Date: Sun, 2 Dec 2012 22:06:44 +0000 (+0100) Subject: vimrc: Use 'noignorecase' for * and #. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=b73ce1235dc62170a241a4c151adfe29d7e50b48;p=config%2Fdotfiles.git vimrc: Use 'noignorecase' for * and #. --- diff --git a/vimrc b/vimrc index 8a6e07f..ccba733 100644 --- a/vimrc +++ b/vimrc @@ -608,10 +608,10 @@ endif " on Freenode for an improved version which doesn't clobber any marks. nnoremap ; :call setline(line('.'), getline('.') . ';') +if has('eval') " * and # for selections in visual mode. Thanks to " http://got-ravings.blogspot.com/2008/07/vim-pr0n-visual-search-mappings.html " and all nerds involved (godlygeek, strull in #vim on Freenode). -if has('eval') function! s:VSetSearch() let l:temp = @@ " unnamed register normal! gvy @@ -622,6 +622,16 @@ if has('eval') endfunction vnoremap * :call VSetSearch()// vnoremap # :call VSetSearch()?? + +" 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('') + let l:regex = substitute(escape(l:cword, '\'), '\n', '\\n', 'g') + let @/ = '\C\V'. '\<' . l:regex . '\>' + endfunction + nnoremap * :call NSetSearch()// + nnoremap # :call NSetSearch()?? endif " I often type "W" instead of "w" when trying to save a file. Fix my mistake.