5

I have set smartcase in my init.vim so searching with /lowercase is case-insensitive, which is usually what I want. However, I sometimes want to do a case-sensitive search where my target is all lowercase, like /include.

I know that prepending a search with \c as in /\csearch makes the whole search case-insensitive.

Is there a quick way (maybe similar to the \c) with smartcase set to make just 1 search instance case-sensitive without using uppercase characters in the search?

1 Answer 1

10

You can use \C to force the pattern to be case-sensitive.

See :help /\C, which explains it alongside \c:

\C does the opposite: Force matching case for the whole pattern.

In your specific case: /\Cinclude will search for only the lowercase matches of "include".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.