Perform Case Insensitive Searches in Vi or Vim

The default behavior of searches in vi/vim is case sensitive. A simple setting allows case insensitive searches.


By default, the following search string entered in command mode will find only instances of Tech-Recipes which match the upper and lower case exactly:

/Tech-Recipes

To ignore case in the searches, enter the following command:

:set ignorecase

This command can be abbreviated :set ic. To turn off this feature, use the following:

:set noignorecase

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.

  • Aaron

    Likewise, I’ve just figured :set ignorecase can be abbreviated as

    :set ic

  • Mini

    Great ! Just can’t figure out how come I’ve never looked for this before !!

  • Guest

    It looks as if backslashes are being eaten by the comment engine.

    That is:
    [slash]expression[backslash]c
    i.e., add a backslash c anywhere in your search expression. Usually people add it at the end for readability.

    • Johnny

      Thanks for correcting the previous answer 

  • Amit Verma

    Great help indeed (In Comment section as well).
    Thank you all, fellows..