0

When running the vim command :!echo A && echo B the result is as expected

A B Press ENTER or type command to continue 

However when I try to do the same thing with the new integrated terminal using the command :term echo A && echo B, the result is instead

1 A && echo B ~ ~ ... ~ ~ !echo A && echo B [finished] 

with the entirety of the rest of the command interpreted as input for the first echo. This also appears for ; and with other commands. Is there any way to unescape the &&s, or otherwise add arguments to make the behaviour of :term mimic that of :!?

2
  • the && is actually a Shell feature and nothing that your echo executes. Therefore, you need to run the command through a shell. Commented Jul 13, 2021 at 19:49
  • Welcome to Vi and Vim! Commented Jul 14, 2021 at 1:56

1 Answer 1

1

The trick is to provide the ++shell argument to :terminal:

:term ++shell echo A && echo B 

This is because :terminal tries to execute the entire command as one command, without letting a shell interpret it, unless you tell it to run it through your shell.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.