简体   繁体   English

我的vimrc上的vnoremap和nnoremap / \ v

[英]vnoremap and nnoremap /\v on my vimrc

I have the following two lines in my .vimrc : 我的.vimrc有以下两行:

nnoremap / /\v
vnoremap / /\v

When I open a file using Vim: 当我使用Vim打开文件时:

vim myfile.c

and press / , /\\v appears at the bottom, and I can search like I normally do in Vim. 并按//\\v出现在底部,我可以像往常一样在Vim中进行搜索。 But what is the meaning of /\\v , and what do the above two lines signify? 但是/\\v是什么意思,以上两行代表什么?

\\v at the start of a search pattern activates Vim's “very magic” search mode. \\v在搜索模式的开头激活了Vim的“非常神奇”的搜索模式。

In Vim, “magic” refers to the level of characters used as symbols in a search string. 在Vim中,“magic”指的是在搜索字符串中用作符号的字符级别。 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. 在“魔术”模式中(对于以\\m开头的搜索模式激活),某些字符具有特殊含义,而其他字符则需要转义才能具有相同的含义。 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. 在“非常神奇”的模式中,几乎所有不是数字0-9或字母A-Z(两种情况)的字符都有特殊含义,没有转义。

A table listing different meanings of characters in the different modes is in :help \\v . 列出不同模式中字符的不同含义的表格在:help \\v For more on the idea of Vim magic in general, see :help magic . 有关Vim魔法的概念,请参阅:help magic

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM