1

Is it possible to silently run an external command, but show the output on the prompt only if there was any?

1
  • You can try let output = system(...) and then check if output is not empty and echo output
    – Maxim Kim
    Dec 4 '19 at 15:45
0

If by external command you do mean shell commands then you can try using system function :h system():

No output (on Windows)

let s:output = system("title")
if s:output != ''
    echom s:output
endif

Output

let s:output = system("date")
if s:output != ''
    echom s:output
endif

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.