Case-insensitive search in Vim
In Vim, if you want to find a word in a text, you run /something
, then hit enter and move between the results with n
/ p
(see :help search-commands
).
By default it's case-sensitive, so if you have a text like this:
This is something. Something is good. sOmEtHing!
It will only find the first something
(with lowercase s
).
If you'd like to capture all occurrences no matter which case is used (case-insensitive search), you can append \c
to your search pattern, like this:
/something\c
If you want this behavior by default, you can turn on the option:
set ignorecase
There's also a so-called "smartcase" (:help smartcase
) which works as case-insensitive if you only use lowercase letters; otherwise, it will search in case-sensitive mode.
set smartcase