VScode in ,R Language and Julia You can default to ctrl+enter Execute the current line , And move to the next line , however python no way , Only the current line can be executed .
How to set it , You can execute the current line , And automatically jump to the next line , So you can write code happily , and Rstudio equally .
First, install the plug-in .
stay setting.json in , Add the following code :
"macros": { // update: requires macros extension by publisher:"geddski"
"pythonExecSelectionAndCursorDown": [
"python.execSelectionInTerminal",
//"vscode.window.activeTextEditor.show()",
"cursorDown"
]
}
stay keybindings.json Add the following code
{
"key": "ctrl+enter",
//"command": [ "python.execSelectionInTerminal", "cursorDown" ],
"command": "macros.pythonExecSelectionAndCursorDown",
"when": "editorTextFocus && editorLangId == 'python'"
},
to update 1: How to find keybindings.json
Shortcut key :ctrl +K + S
Click the right button :
The following setting interface will appear :
Write code
Put the mouse on the first line , Click on ctrl+enter
vscode The result is :
The mouse automatically jumps to the second line :