When I do a in-document search with / or ? it only performs a case sensitive search when a capital letter appears in the search pattern because of the combination of the ignorecase and smartcase settings. Is there a way to mimic this behavior with the :grep command without needing to manually add the -i setting manually every time?
1 Answer
You may be interested in looking at :vimgrep which can use Vim's regular expressions for pattern matching. This includes honoring 'ignorecase' and its related options, unless you explicitly state otherwise. Specifically, if a "\c" appears in a pattern it makes the pattern ignore case, and "\C" forces case matching. Look at:
:help :vimgrep
:help /\c(Yes, the forward- and back-slash are meant to be part of the :help command.)