How to do a case insensitive search in vim

/\cYourSearchKeywords case insensitive /\CYourSearchKeywords case sensitive, which is the default behaviour

A few other ideas:

  • \c can appear anywhere in the pattern, so if you type a pattern and then decide you wanted a case-insensitive search, just add a \c at the end.

  • add set ignorecase for case-insensitive searching in my vimrc, and I can use \C to do a case-sensitive search

  • There's also set smartcase which will automatically switch to a case-sensitive search if you use any capital letters

    • Remember! set smartcase applies only when set ignorecase is already active

Reference

Comments

  1. Markdown is allowed. HTML tags allowed: <strong>, <em>, <blockquote>, <code>, <pre>, <a>.