From b73ce1235dc62170a241a4c151adfe29d7e50b48 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 2 Dec 2012 23:06:44 +0100 Subject: [PATCH] vimrc: Use 'noignorecase' for * and #. --- vimrc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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. -- 2.44.1