在vim命令模式下,管道字符有什么作用?(例如,:vimgrep/pattern/文件| another_cmd) [英] What does pipe character do in vim command mode? (for example, :vimgrep /pattern/ file | another_cmd)
问题描述
在vim命令模式下管道字符有什么作用?
What does pipe character do in vim command mode?
例如,:vimgrep/pattern/file |打开
它是否像 Linux 命令行中的管道? vimgrep
的内容通过管道传递到 copen
?
Does it act like a pipe in Linux Command Line? Contents of vimgrep
gets piped to copen
?
还是在命令行中分隔诸如;
之类的命令?
Or does it separate commands like ;
in Command Line?
推荐答案
| 用于一次执行多个命令.
| is used to execute more than one command at a time.
在您的示例中:
:vimgrep /pattern/ file | copen
这将在指定的文件中查找模式,然后打开一个窗口以显示模式的当前发生列表.
This finds for the pattern in the specified file and then opens a window to show current list of occurrence of pattern.
仅在先前命令成功的情况下才执行第二个命令(和后续命令).
The second command (and subsequent commands) are only executed if the prior command succeeds.
这篇关于在vim命令模式下,管道字符有什么作用?(例如,:vimgrep/pattern/文件| another_cmd)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!