what is the meaning of \ | in a map vim command?

↘锁芯ラ 提交于 2019-12-20 03:03:25

问题


Here is a map command.

nnoremap <F5> :w\|!R %<CR>

1.what is the meaning of \ here?
2. does | mean pipe ?


回答1:


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).

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>

Note that you can also write <Bar> (cp. :help key-notation) instead of \|, and the former is more frequently used.



来源:https://stackoverflow.com/questions/21185216/what-is-the-meaning-of-in-a-map-vim-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!