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 |
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'\'
.
Example:
:echo "hello" | echo "goodbye"
Output:
hello
goodbye
NB: You may find that your ~/.vimrc
doesn't support mapping |
, or \|
. In these cases, try using <bar>
instead.