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. Jul 13 at 19:49
  • Welcome to Vi and Vim!
    – D. Ben Knoble
    Jul 14 at 1:56
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.