简体   繁体   English

Visual Studio Code - 集成终端 - Ctrl + Z

[英]Visual Studio Code - Integrated Terminal - Ctrl + Z

I'm using visual studio code on Windows and using the integrated terminal with git-bash for Windows.我在 Windows 上使用 Visual Studio 代码,并在 Windows 上使用带有 git-bash 的集成终端。

I just can't get the Ctrl+Z to work inside the integrated terminal, outside (external) it works just fine.我只是无法让 Ctrl+Z 在集成终端内工作,在外部(外部)它工作得很好。 What can be wrong?有什么问题? How can I check why vscode is getting in the way with the Ctrl+Z shortcut?如何检查为什么 vscode 妨碍了 Ctrl+Z 快捷键?

As far as I am aware, there is no "undo" shortcut in terminal.据我所知,终端中没有“撤消”快捷方式。

Control + Z sends SIGSTOP to whatever program is currently running, killing it without allowing it to clean up. Control + ZSIGSTOP发送到当前正在运行的任何程序,在不允许它清理的情况下杀死它。

Here is a great post about Control + Z and Control + C in bash . 是一篇关于bash Control + ZControl + C的好文章。

Here is the list of available shortcuts in VS Code, if you are interested.如果您有兴趣, 这里是 VS Code 中可用快捷方式的列表。

Certain keymap extensions can do this in regular vscode.某些键盘映射扩展可以在常规 vscode 中做到这一点。 Try to uninstall them if this is in there, but terminals don't have an "Undo".如果它在那里,请尝试卸载它们,但终端没有“撤消”。

You could do something like this.你可以做这样的事情。 Create your own keybinding in your keybindings.json:在 keybindings.json 中创建您自己的键绑定:

{
  "key": "ctrl+z",
  "command": "workbench.action.terminal.sendSequence",
  "args": {
    "text": "kill -TSTP -1\u000D"
  },
  "when": "terminalFocus"
}

Use whatever options to that kill command you want.使用您想要的kill命令的任何选项。 \ is a return so it runs immediately. \ 是一个返回所以它立即运行。

"text": "kill -CONT -1\ " to resume the process. "text": "kill -CONT -1\ "恢复进程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM