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.

5 Responses to “Perform Case Insensitive Searches in Vi or Vim”

  1. January 27, 2010 at 10:15 am, Aaron said:

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

    :set ic

    Reply

  2. June 15, 2010 at 10:30 am, Mini said:

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

    Reply

  3. August 10, 2010 at 8:02 pm, Guest said:

    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.

    Reply

    • May 18, 2011 at 12:33 pm, Johnny said:

      Thanks for correcting the previous answer 

      Reply

  4. August 18, 2010 at 2:14 pm, Amit Verma said:

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

    Reply

Leave a Reply