Searching for literal text
Vim’s search functionality supports a rich regular expression language. But, as we mentioned in the last section, we’re going to explore that in another lesson.
If you’re familiar with regular expressions already, though, you’ll know that certain characters have special meanings. The . character, for example, will match any character when used in a search pattern. If we initiate a search with /., it will match every character in the document.
Well, what if we want to search for a literal . character? Our first option is to escape the . with \. — so our search command would look like /\.. This works, but \ is kind of difficult to type, and if we want to search for something like ... then it gets even more cumbersome.
The best option here is to tell Vim that we want to search for a literal string — i.e. not a regular expression — by prefixing our search term with \V. This tells Vim not to use the special regex meanings for characters in our search, and to treat them as literal text. If we specify \V, only a backslash and the terminating character (usually / or ?) have special meaning.
Work through the checklist below. First, see the . wildcard match everything — every character gets highlighted. Then use \V to hunt down the only line in the document that contains a literal HAYST.CK.