Perform case insensitive searches in vi or vim

Contributor Icon Contributed by qmchenry  
Tag Icon Tagged: UNIX  

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:

:set noignorecase

 

5 Comments -


  1. Aaron said on January 27, 2010

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

    :set ic

  2. Mini said on June 15, 2010

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

  3. Guest said on August 10, 2010

    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.

  4. Amit Verma said on August 18, 2010

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

  5. Johnny said on May 18, 2011

    Thanks for correcting the previous answer 

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -