gpt4 book ai didi

python - VS代码在运行ctrl时移至下一行+输入

转载 作者:行者123 更新时间:2023-12-03 16:43:56 29 4
gpt4 key购买 nike

我是VS Code的新手,可以使用Ctrl + Enter将代码运行到python交互式窗口中。我希望光标自动移动到下一行,因此我可以逐行浏览代码。

能做到吗?

最佳答案

this blog post中所述,这是使用Ctrl + Enter进入下一行的方法,从而使VS Code运行代码选择:

###############################
# 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"
]
}

关于python - VS代码在运行ctrl时移至下一行+输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58404225/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com