Tuesday, March 28, 2006

Ignore case in vim searches

Ahhh, there it is! I've often wanted to know how to make "/" searches in vim case insensitive, and today somebody at work enlightened me. If \c appears anywhere in a pattern the whole pattern is assumed to be case insensitive. So to search for the string "root" while ignoring case you'd use

Take a look at :help ignorecase in vim for more info.


Salvatore said...

Finally, thanks for the info.

Erik Scrafford said...

Neat, didn't know that one!

If you want all your searches to be case insensitive, type:

:set ic

John said...

I use the ignorecase and smartcase settings as default, and they work great for me. Any search with an uppercase character becomes a case sensitive search.

\c is good to know when your working on other people's stations.

:set ic
:set scs

Erich said...

thanks mate