简体   繁体   English

通过键盘快捷键在vscode中运行python?

[英]run python in vscode via keyboard shortcut?

It shows F5 but how do I do that in mac's keyboard?它显示 F5 但我如何在 mac 的键盘上执行此操作? also when I click manually the 'run' menu, it has a dropdown to select, can I auto run the program when I save a file?另外,当我手动单击“运行”菜单时,它有一个下拉菜单到 select,我可以在保存文件时自动运行程序吗?

Hey Just press Fn + Ctrl + F5 it won't ask you to select.嘿只需按 Fn + Ctrl + F5 它不会要求您输入 select。 if you press F5 it will ask to select as it includes debug.如果您按 F5,它将询问 select,因为它包括调试。

Old Version旧版

Ctrl + F5 for Win
Fn + Command + F5 on Mac

if it doesn't work try this in the new version如果它不起作用,请在新版本中尝试这个

Command + F5

Reference for https://github.com/microsoft/vscode/issues/27685 https 参考资料://github.com/microsoft/vscode/issues/27685

When on a MAC, any shortcut using a function key seems rather useless.在 MAC 上,使用 function 键的任何快捷方式似乎都毫无用处。

Jason Murray shows on his block nicely how to set an appropriate shortcut. Jason Murray在他的街区很好地展示了如何设置适当的快捷方式。

  1. Click on the gear in the lower-left corner of the screen and select Keyboard Shortcuts.单击屏幕左下角的齿轮和 select 键盘快捷键。
  2. Search for "Python: Run Python File in Terminal."搜索“Python:在终端中运行 Python 文件”。
  3. Click on the search result and enter a keyboard shortcut sequence.单击搜索结果并输入键盘快捷键序列。 Jason proposes CTRL+r , and I found that control+r also works well on macOS Jason 提出CTRL+r ,我发现control+r在 macOS 上也很好用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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