我想要sort
和uniq
一些台词。我做到了
:'<,'>! sort -f|!uniq
但它给出了一个错误。可以在一行上运行两个命令吗?
答案1
你不需要第二个!
。它应该只是:
:'<,'>! sort -f | uniq
从:help :!
:
Any '!' in {cmd} is replaced with the previous
external command (see also 'cpoptions'). But not when
there is a backslash before the '!', then that
backslash is removed. Example: ":!ls" followed by
":!echo ! \! \\!" executes "echo ls ! \!".
A '|' in {cmd} is passed to the shell, you cannot use
it to append a Vim command. See :bar.
这将!uniq
是最后运行的命令,并uniq
附加:
:!ls
:!echo !uniq
输出:
lsuniq
Press ENTER or type command to continue