同一行上的多个命令 [英] Multiple commands on same line
问题描述
我一直在尝试寻找可以让我在Vim中的同一行上运行多个命令的东西,类似于在* nix系统或& $ c $中使用分号分隔命令。 c>在Windows中。有办法吗?
I've been trying to find something that will let me run multiple commands on the same line in Vim, akin to using semicolons to separate commands in *nix systems or &
in Windows. Is there a way to do this?
推荐答案
酒吧 |
将允许你这样做。从:help:bar
A bar |
will allow you to do this. From :help :bar
'|'
可用于分隔命令,因此您可以在
一行中给出多个命令。如果要在参数中使用'|',请在其前加上
'\'
。
'|'
can be used to separate commands, so you can give multiple commands in one line. If you want to use'|'
in an argument, precede it with'\'
.
示例:
:echo hello |回声再见
输出:
hello
goodbye
注意:您可能会发现您的 〜/ .vimrc
不支持映射 |
或 \ |
。在这些情况下,请尝试使用< bar>
。
NB: You may find that your ~/.vimrc
doesn't support mapping |
, or \|
. In these cases, try using <bar>
instead.
这篇关于同一行上的多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!