VIM - 在同一行上的多个命令
问题描述:
我一直在尝试找到一些东西,让我在vim的同一行上运行多个命令,类似于使用分号分隔* nix系统中的命令或&
在窗口。有办法吗?
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?
答
A bar |
允许你这样做。 :help:bar
A bar |
will allow you to do this. From :help :bar
'| / code>可用于分隔命令,因此您可以在一个
行中给出多个命令。如果您想在参数中使用'|'
,请在其前加上'\'
。
示例:
:echohello| echogoodbye
输出:
hello
goodbye
注意:您可能会发现 〜/ .vimrc
不支持映射 |
或 \ |
。在这些情况下,请改用< bar>
。
NB: You may find that your ~/.vimrc
doesn't support mapping |
, or \|
. In these cases, try using <bar>
instead.