6

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?

3 Answers 3

6

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you, this was helpful. Nothing was bound there, so I bound my own. I'll probably accept this after a while.
@Nathaniel. Okay :)
I also use Windows mostly, I feel usually you can find the key binding information for some buttons when you hover on them, for example "Split Editor Right(Ctrl + )" for split button usually on the right top of a editor view. If there is no such info, the corresponding binding is empty and you can set your own usually.
1

I think you can bind the shortcut by yourself.

enter image description here

enter image description here

enter image description here

Comments

0

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.