VScode中,R语言和Julia可以默认ctrl+enter执行当前行,并调到下一行,但是python不行,只能执行当前行。
如何设置呢,可以执行当前行,并自动跳到下一行,这样就可以愉快的写代码了,和Rstudio一样。
1. 安装插件:macros
首先要安装这个插件。

2. 设置setting.json
在setting.json中,添加如下代码:
"macros": { // update: requires macros extension by publisher:"geddski"
"pythonExecSelectionAndCursorDown": [
"python.execSelectionInTerminal",
//"vscode.window.activeTextEditor.show()",
"cursorDown"
]
}
3. 设置快捷键keybindings.json:
在keybindings.json中添加下面代码
{
"key": "ctrl+enter",
//"command": [ "python.execSelectionInTerminal", "cursorDown" ],
"command": "macros.pythonExecSelectionAndCursorDown",
"when": "editorTextFocus && editorLangId == 'python'"
},更新1:怎么找到keybindings.json
快捷键:ctrl +K + S

点击右边按钮:

即可出现下面设置界面:

4. 测试效果
编写代码

把鼠标放在第一行,点击ctrl+enter
vscode中出现结果:

鼠标自动跳转到第二行:


欢迎关注公众号:育种数据分析之放飞自我

















