VSCode 把代码发送到激活状态下的终端
VSCode 把代码发送到激活状态下的终端
你有没有遇到过这样的情况:在VSCode里写Python代码时,经常需要打开好几个终端。但问题是,Shift+Enter快捷键只能把选中的代码发送到第一个终端。有时候,如果VSCode意外重启,再用REPL调试代码时,Shift+Enter快捷键只会把代码发送到一个新的终端里。
解决办法就是, 在VSCode中ctrl+shift+p, 输入 open keyboard shotcut (JSON). 新建一个 keybindings.json 文件,然后把下面的内容放进去。这样设置后,就可以把代码发送到当前激活状态的终端了。
// Place your key bindings in this file to override the defaults
[
{
"key": "shift+enter",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "${selectedText}\n"
},
"when": "editorTextFocus && terminalIsOpen"
}
]
人工智障与神经病网络
https://www.cnblogs.com/JiangOil/

浙公网安备 33010602011771号