It's fairly well known that in vim '/' is case sensitive search. That's almost always what I want, but very occasionally I want a case insensitive search. Search can be set to ignore case for the life of the vim session by using :set ignorecase (:set ic) and likewise :set noignorecase turns off the feature. That's really obnoxious if you only want one insensitive search. Luckily there's a better solution! Putting \c at the end of your search query makes only that search case insensitive.
Try using "set ignorecase" AND "set smartcase" in your .vimrc. Now if you search for all-lowercase strings, it will be case-insensitive; if your query has one or more uppercase letters then it will be case-sensitive.
ReplyDeleteIf you still need to do a case-sensitive search for a lowercase string, you can do it using \C instead of \c.
Oh, thanks for the hint! That's in my vimrc now.
ReplyDeleteI ran across http://www.linuxjournal.com/article/3805?page=0,0 looking up what those commands do. It's got some other good tricks too.