VIM case sentive / insensitive search

VIM

How to make VIM insensitive to uppercase and lowercase letters in a search?

Vim by default is case sensitive but this behavior can be modified through the options: ignorecase, ic, noignorecase, noic or adding c to the search pattern

Note: If you are in insert mode you must press Esc to switch to Normal mode

Case insentive temporarily

:set ignorecase

O

:set ic

Case sensitive

:set noignorecase

O

:set noic

Using c

/category\c

Find all words that contain category regardless of uppercase and lowercase letters

Case insensitive permanently

Edit the file /etc/vimrc (global) or ~/.vimrc (at the level of user) and add:

set ic

O

set ignorecase

Further reading

  • man vim
  • :help 'ignorecase', :help ignorecase
The tutorials here on LibreByte are provided under a free software licence. if you like my work you should consider:
Buy a Hosting/VPS or Dedicated Server at MCKHost

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.