2

This question already has an answer here:

I have a script that writes output to a text file which I have open in a split side-by-side my code.

If I use :! python % it will close the window to display the terminal, show the script's terminal output and ask me to press enter to get back to my editor screen.

Since all I care about can be seen in the text file I already have open, I want to be able to just run the script and have no disruptions on screen. Alternatively, is it possible to have a 'mini-terminal' open as a split so that I can see the output of the script if need be?

marked as duplicate by Martin Tournoij Apr 30 '15 at 17:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

For your situation, I believe you could do :call system('python '.%) to run the same thing without showing the output.

When I have a script that can write to stdout, I usually open a new window and do :r !python # to append the python output to the buffer directly.

Note that neither of these solutions are asynchronous-- vim will pause while the script is running. For async, you'd want to look at dispatch (or one of the underlying techniques it uses) or neovim.

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