vi/vim case insensitive search (how to)

vim search FAQ: How do I perform a case-insensitive search in vim? (Or, How do I ignore case with a vi/vim search?)

Using the vi (or vim) editor you can perform a case-insensitive search by first issuing this "set" command:

:set ignorecase

As its name implies, this set command tells the vim editor to ignore case (uppercase or lowercase characters) in your vim search.

After you issue this command, you can then search vi using the usual "/" search character. For instance, if you're looking for the text string "foo", "Foo", "FOO", or other variations, you could just enter your vim search string like this:

/foo

If you're new to vim, the "/" character takes you to vi's last-line mode, and from there you type in your desired search string, then press [Enter].

vim last line mode commands

If you're not familiar with the colon commands (usually referred to as "last line" commands, or "last line mode"), when you type the ":" character you'll see focus switch to the last line of the vi editor. Then the actual command (in this case set ignorecase) follows that. (Also, press [Enter] after typing in that command.)

Conversely, if you want to switch back to a case-sensitive search type this:

:set noignorecase

Off the top of my head I don't know if all vi commands can be negated like that, but it works with all the ones I can think of right now.