Wiki

by yszheda

View project onGitHub

Tip 72: Tune the Case Sensitivity of Search Patterns

Return to the top: <<Practical Vim>>

Setting Case Sensitivity Globally

  • enabling the 'ignorecase' setting.

Setting Case Sensitivity per Search

  • \c: ignore case
  • \C: force case sensitivity

Enabling Smarter Default Case Sensitivity

  • enabling the 'smartcase' option.

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h /ignorecase

Example:

Pattern 'ignorecase' 'smartcase' Matches
foo off - foo
foo on - foo Foo FOO
foo on on foo Foo FOO
Foo on on Foo
Foo on off foo Foo FOO
\cfoo - - foo Foo FOO
foo\C - - foo