I normally enable smartcase
in my .vimrc
.
Without smartcase
:
- If I want case-insensitive search, I write in upper-case or lower-case (doesn't matter) and append a
\c
at the end of the query. - Case-sensitive search happens by default.
With smartcase
:
- If I want case insensitive search, I write all in lower-case.
- If I want case sensitive search, I write the upper-case letters in upper-case.
But, with smartcase
enabled, how can I say that I want a case sensitive search of a lower-case pattern? I was expecting that appending a \c
would revert the type of search (so that if I had written all in lower-case, i.e. case-insensitive search, it would turn to a case-sensitive search; and if I had written some upper-case letters, i.e. case-sensitive search, it would turn to a case-insensitive search), but that does not seem to be the case (no pun intended).
Best Answer
Use
\C
(uppercase) in your search patternSee
:help /ignorecase
: "\C" does the opposite: Force matching case for the whole pattern.