Warm tip: This article is reproduced from serverfault.com, please click

How to do case insensitive search in Vim

发布于 2010-02-18 09:17:00

I'd like to search for an upper case word, for example COPYRIGHT in a file. I tried performing a search like:

/copyright/i    # Doesn't work

but it doesn't work. I know that in Perl, if I give the i flag into a regex it will turn the regex into a case-insensitive regex. It seems that Vim has its own way to indicate a case-insensitive regex.

Questioner
Haiyuan Zhang
Viewed
0
52.5k 2020-05-15 09:27:45

You can use the \c escape sequence anywhere in the pattern. For example:

/\ccopyright or /copyright\c or even /copyri\cght

To do the inverse (case sensitive matching), use \C (capital C) instead.