简体   繁体   中英

Killing Python with a keybinding in VS code

I'm experimenting with some Python code that generates sound. I'm using VS code. I've set up a keyboard shortcut for the "Python: Run Python File" action, which starts the sound playing in a terminal window.

In order to stop the sound, I have to first click in the terminal panel and then I can do CMD-. (Mac equivalent of ctrl-C.) This takes a couple of seconds though, and if my code is unexpectedly producing a very loud sound I'd like to be able to stop it as quickly as possible.

So my question is, is there a way I can set up a keybinding to immediately stop the running Python process, without first needing to click in the terminal panel where it's running?

There are a number of actions that sounded like they should work, such as "Terminal: Kill the Active Terminal in Editor Area" (bound to CMD-w by default). However, this just seems to close the source file without affecting the terminal at all.

try this settings i guess third setting works for you:)

终端杀

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM