Running a python script from gVim on Windows keeps popping up a terminal window (cmd), even when adding the silent parameter to the command: execute 'silent !python script.py'. Basically the script has no output, and I am calling it with a keymap to encrypt/decrypt some files. The terminal cmd popup is getting annoying. Can I get rid of it somehow?

  • 1
    Have you tried using system() instead?
    – Heptite
    Nov 10, 2021 at 3:11
  • Hello, I freakin love u rn. Did that and it worked like a charm. Suppressed the output with: let empty = system(‘script’) Nov 10, 2021 at 10:06
  • Welcome to Vi and Vim! Answers should go in answers (as I alluded to with my earlier comment asking Heptite to move their comment). That includes self-answers! PS Stackexchange uses markdown, so using backticks would give you code-formatting in posts and comments.
    – D. Ben Knoble
    Nov 10, 2021 at 16:45

2 Answers 2


Recent Vims can make use of the internal terminal to run external scripts. To enable this option, simply use:

:set guioptions+=!

See also the documentation :h 'go-!' I am not sure this works in your case, but it is worth a try :)


There exists more than one way to prevent the terminal window from popping up in Windows, but I find the easiest way is to just use system(). For example, if you don't care about the output of the script (as is the case here):

:call system('python script.py')

Note that you can get the return value by checking v:shell_error after the command has been run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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