如何在 VS Code 终端中突出显示用于复制和粘贴的文本? [英] How do I highlight text for copying and pasting in the VS Code terminal?
问题描述
如何创建快捷方式来突出显示终端文本:Ctrl+Shift+Right/Left、Ctrl+Shift+End、Ctrl+Shift+Home - 正如在 PowerShell ISE 中实现的那样?
How do I create shortcuts to highlight Terminal text: Ctrl+Shift+Right/Left, Ctrl+Shift+End, Ctrl+Shift+Home - as it's implemented in PowerShell ISE?
如何创建快捷方式来按单词移动光标:Ctrl+Right/Left,类似于 PowerShell ISE?
How do I create shortcuts to move cursor by words: Ctrl+Right/Left, similar to PowerShell ISE?
推荐答案
我正在为愿意安装 zsh 的用户添加一个单独的答案.
I'm adding a separate answer for users willing to install zsh.
这是一个不做任何假设的部分解决方案:
This is a partial solution that makes no assumptions:
{
"key": "ctrl+left",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001bb" },
"when": "terminalFocus"
},
{
"key": "ctrl+right",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001bf" },
"when": "terminalFocus"
}
它将为您提供 Windows 风格的 Ctrl-Left/Right 导航.
It will give you Windows-style Ctrl-Left/Right navigation.
这在您的 keybindings.json 中.我的位于 ~\AppData\Roaming\Code\User\keybindings.json
和 ~\AppData\Roaming\Code - Insiders\User\keybindings.json
.(我在桌面上运行 Windows,但在 Linux 上进行远程开发.)
This goes in your keybindings.json. Mine are at ~\AppData\Roaming\Code\User\keybindings.json
and ~\AppData\Roaming\Code - Insiders\User\keybindings.json
. (I run Windows on the desktop but do remote dev on Linux.)
如果我设法进一步了解这个,我会更新.但这并不容易,因为:
I'll update if I manage to get any further with this. But it's not easy, because:
- 在 shell 中无法真正做到:https://superuser.com/questions/555886/why-cant-i-highlight-text-in-a-linux-terminal-emulator-with-shiftarrow-keys立>
- VS Code 中不存在用于在终端中突出显示文本的命令,AFAICS(仅在编辑器中)
这篇关于如何在 VS Code 终端中突出显示用于复制和粘贴的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!