]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - vimrc
vimrc: Use 'noignorecase' for * and # in visual mode.
[config/dotfiles.git] / vimrc
diff --git a/vimrc b/vimrc
index 7a51eba3ba0036c069fc162009a3f6b67dcd260b..9ae5f86cf2f6a52392b5a1fcd7c10b664a6c4c4e 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -190,6 +190,10 @@ if exists('+cursorline')
     set cursorline
 endif
 
+" Highlight all matches on the screen when searching. Use <C-L> (see below) to
+" remove the highlighting until the next search.
+set hlsearch
+
 " Display tabs, trailing space, non breakable spaces and long lines (when
 " wrapping is disabled).
 set list
@@ -364,7 +368,9 @@ if has('eval')
     function! s:VSetSearch()
         let l:temp = @@
         normal! gvy
-        let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
+        " Added \C to force 'noignorecase' while searching the current visual
+        " selection. I want to search for the exact string in this case.
+        let @/ = '\C' . '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
         let @@ = l:temp
     endfunction
     vnoremap * :<C-U>call <SID>VSetSearch()<CR>//<CR>