程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

CTRL enter Python in vscode executes the current line and automatically jumps to the next line

編輯:Python


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 .

1. Installing a plug-in :macros

First, install the plug-in .

2. Set up setting.json

stay setting.json in , Add the following code :

"macros": { // update: requires macros extension by publisher:"geddski"

"pythonExecSelectionAndCursorDown": [
"python.execSelectionInTerminal",
//"vscode.window.activeTextEditor.show()",
"cursorDown"
]
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.

3. Set shortcut key keybindings.json:

stay keybindings.json Add the following code

{

"key": "ctrl+enter",
//"command": [ "python.execSelectionInTerminal", "cursorDown" ],
"command": "macros.pythonExecSelectionAndCursorDown",
"when": "editorTextFocus && editorLangId == 'python'"
},
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

to update 1: How to find keybindings.json

Shortcut key :​​ctrl +K + S​

Click the right button :

The following setting interface will appear :

4. The test results

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 :

Welcome to the official account : Analysis of breeding data




  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved