Reputation: 14970
I have the following two lines in my .vimrc
:
nnoremap / /\v
vnoremap / /\v
When I open a file using Vim:
vim myfile.c
and press /
, /\v
appears at the bottom, and I can search like I normally do in Vim. But what is the meaning of /\v
, and what do the above two lines signify?
Upvotes: 10
Views: 2414
Reputation: 1949
\v
at the start of a search pattern activates Vim’s “very magic” search mode.
In Vim, “magic” refers to the level of characters used as symbols in a search string. In “magic” mode (activated for a search pattern prefaced with a \m
), certain characters have special meaning, and others will need escaping to have the same meaning. In “very magic” mode, nearly all characters which aren’t the digits 0–9 or the letters A–Z (either case) have a special meaning, without escaping.
A table listing different meanings of characters in the different modes is in :help \v
. For more on the idea of Vim magic in general, see :help magic
.
Upvotes: 11