PracticalVim Tip74 - yszheda/wiki GitHub Wiki

Tip 74: Use the V Literal Switch for Verbatim Search

Return to the top: <>

Use of `\V` means that in the pattern after it, only the backslash has a special meaning.

References:

Example: Search 'a.k.a'

  • running `/a.k.a`: "." symbol matches any character
  • escaping: `/a\.k\.a\.`
  • using `\V` literal switch to enable very nomagic search: `/\Va.k.a.`

History Lesson: On the Heritage of Vim's Pattern Syntax

Vim's default is _magic_ search, while _nomagic_ search emulates the behavior of vi. They can enabled with the `\m` and `\M` switches, respectively.

  • `\M` is similar to `\V`, except that '^' and '$' symbols automatically take on a special meaning.
⚠️ **GitHub.com Fallback** ⚠️