Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
912 views
in Technique[技术] by (71.8m points)

vim - Multiple commands on same line

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...