VS Code 在运行 ctrl + enter 时移到下一行 [英] VS Code move to next line on run ctrl + enter
本文介绍了VS Code 在运行 ctrl + enter 时移到下一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 VS Code 的新手,我使用 Ctrl + enter 将代码运行到 python 交互式窗口中.我希望光标自动移动到下一行,以便我可以逐行浏览代码.
I'm new to VS Code and running code into the python interactive window using Ctrl + enter. I would like the cursor to move to the next line automatically so I can go through the code line-by-line.
这能做到吗?
推荐答案
如这篇博文中所述,这里是如何使用 Ctrl + enter 使 VS Code 运行代码选择并移动到下一行:
As explained in this blog post, here is how you can make VS Code run code selections using Ctrl + enter and move to next line:
###############################
# 1. Install extension "macros" in Visual Code
#
# Hit View on top menu
# Search for extension named "macros" (by geddski)
# Install "macros" extension
#
###############################
###############################
# 2. Add code below to keybindings.json
#
# Hit <Crtl> + <Shift> + <P>
# Enter in search bar: JSON
# Select Open keyboard shortcuts
#
###############################
{
"key": "ctrl+enter",
"command": "macros.pythonExecSelectionAndCursorDown",
"when": "editorTextFocus && editorLangId == 'python'"
}
###############################
# 3. Add code below to settings.json
#
# Hit <Crtl> + <Shift> + <P>
# Enter in search bar: JSON
# Select Open settings
#
###############################
"macros": { // Note: this requires macros extension by publisher:"geddski"
"pythonExecSelectionAndCursorDown": [
"python.execSelectionInTerminal",
"cursorDown"
]
}
这篇关于VS Code 在运行 ctrl + enter 时移到下一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文