\是什么意思?在地图 vim 命令中? [英] what is the meaning of \ | in a map vim command?
问题描述
这是一个地图命令.
nnoremap <F5> :w\|!R %<CR>
1.这里的\是什么意思?
2.做|意思是管道?
1.what is the meaning of \ here?
2. does | mean pipe ?
推荐答案
|
字符分隔两个 Ex 命令,参见 :help :|
.这就像 C 和 Java 等编程语言中的 ;
.它与管道无关;Vim 没有这个概念(通常在 shell 中可以找到).
The |
character separates two Ex commands, see :help :|
. It's like ;
in programming languages like C and Java. It has nothing to do with pipes; Vim hasn't that concept (which is typically found in shells).
这里转义了,让整个命令序列都属于映射;即它映射到 :w|!R %
.如果不转义,Vim 将改为执行以下操作:
It is escaped here so that the entire command sequence belongs to the mapping; i.e. it maps to :w|!R %<CR>
. Without escaping, Vim would execute the following instead:
:nnoremap <F5> :w
:!R %<CR>
注意你也可以写
(cp.:help key-notation
)而不是\|
,并且前者使用频率更高.
Note that you can also write <Bar>
(cp. :help key-notation
) instead of \|
, and the former is more frequently used.
这篇关于\是什么意思?在地图 vim 命令中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!