N. Virgo
N. Virgo

Reputation: 8439

Current shortcut to run Python in VS Code

I use VS Code on a Mac laptop. If I'm using Python I can run the code by pressing the little arrow in the top right,

enter image description here

However, I can't seem to find a keyboard shortcut for this. There is an old question, How to execute Python code from within Visual Studio Code, but all the answers there seem either to be obsolete or not to work on a Mac. One of them says that the F5 key should work, but my Mac has a useless touchbar instead of function keys so it's no help to me.

tl;dr is there a shortcut to run Python code on a modern VS Code installation besides F5, or an easy way to set one up?

Upvotes: 6

Views: 9353

Answers (3)

You can try with ctrl+shift+b in windows or ⌘+shift+b in MacOS.

Upvotes: 0

Steven-MSFT
Steven-MSFT

Reputation: 8431

I think you can bind the shortcut by yourself.

enter image description here

enter image description here

enter image description here

Upvotes: 1

Molly Wang-MSFT
Molly Wang-MSFT

Reputation: 9521

I'm using Windows so i can't give you a specific answer. But Code > Preferences > Keyboard Shortcuts, search with keyword run python file, you will get related shortcuts.

Upvotes: 6

Related Questions