Mac, vsCode 单行执行快捷键(shift + ente
2020-07-16 本文已影响0人
工程无尽藏
最近在学Python,使用的vsCode。但是遇到个小问题:shift + enter在Terminal中执行单行的默认快捷键组合没用,很不方便。
搜索了一番,找到了一个替代方案。把快捷键改成了F9,很香。具体操作方式如下:
1、进到 View > Command Palette... and run "Preferences: Open Keyboard Shortcuts (JSON)"
2、添加以下内容:
[
{
"key": "f9",
"command": "python.execSelectionInTerminal",
"when": "editorTextFocus && !findInputFocussed && !python.datascience.ownsSelection && !replaceInputFocussed && editorLangId == 'python'"
},
]
3、打开一个Python文件,选中单行代码单机右键,找到"Run Selection/Line in Python Terminal",bingo,新快捷键变成F9了。
![](https://img.haomeiwen.com/i2354292/811703d1038edbf1.png)