vim 命令模式下的管道字符有什么作用? (例如:vimgrep /pattern/ file | another_cmd)
What does pipe character do in vim command mode? (for example, :vimgrep /pattern/ file | another_cmd)
管道符在vim命令模式下有什么作用?
例如,:vimgrep /pattern/ file | copen
它在Linux 命令行中是否像管道一样? vimgrep
的内容通过管道传输到 copen
?
或者它在命令行中分隔命令,如 ;
?
|用于一次执行多个命令。
在你的例子中:
:vimgrep /pattern/ file | copen
这会在指定的 文件 中找到 模式 ,然后打开 window 以显示当前出现的列表模式.
第二个命令(和后续命令)只有在前一个命令成功时才会执行。
OP的问题:后者。
这其实是vi的一个特性,不是vim特有的,用来分隔多个命令。之前在这里回答过:
- What does
<Bar>
mean?
- Learning the Vi and Vim Editors, "special meaning as a separator of multiple ex commands".
管道符在vim命令模式下有什么作用?
例如,:vimgrep /pattern/ file | copen
它在Linux 命令行中是否像管道一样? vimgrep
的内容通过管道传输到 copen
?
或者它在命令行中分隔命令,如 ;
?
|用于一次执行多个命令。
在你的例子中:
:vimgrep /pattern/ file | copen
这会在指定的 文件 中找到 模式 ,然后打开 window 以显示当前出现的列表模式.
第二个命令(和后续命令)只有在前一个命令成功时才会执行。
OP的问题:后者。
这其实是vi的一个特性,不是vim特有的,用来分隔多个命令。之前在这里回答过:
- What does
<Bar>
mean? - Learning the Vi and Vim Editors, "special meaning as a separator of multiple ex commands".