shell脚本中 bash_如何在Windows 10的Bash Shell中启用复制和粘贴键盘快捷键

shell脚本中 bash_如何在Windows 10的Bash Shell中启用复制和粘贴键盘快捷键

shell脚本中 bash

shell脚本中 bash_如何在Windows 10的Bash Shell中启用复制和粘贴键盘快捷键

Windows 10’s Bash shell finally has convenient copy and paste keyboard shortcuts, but they’re disabled by default for compatibility reasons. These shortcuts are available in the October 2018 Update, which was originally codenamed Redstone 5.

Windows 10的Bash shell终于有了方便的复制和粘贴键盘快捷键,但是出于兼容性原因,默认情况下它们被禁用。 这些快捷方式在2018年10月更新中可用,该更新最初代号为Redstone 5。

To enable copy and paste keyboard shortcuts, right-click your Linux bash shell window’s title bar, and then select the “Properties” command.

要启用复制和粘贴键盘快捷方式,请右键单击Linux bash shell窗口的标题栏,然后选择“属性”命令。

With Redstone 5’s Sets feature enabled, you have to right-click an empty part of the title bar—not on a tab. Unfortunately, these tabs have been delayed and they do not appear in the final October 2018 Update.

启用Redstone 5的“设置”功能后 ,您必须右键单击标题栏的空白部分(不在选项卡上)。 不幸的是,这些选项卡已被延迟,它们不会出现在最终的2018年10月更新中。

shell脚本中 bash_如何在Windows 10的Bash Shell中启用复制和粘贴键盘快捷键

Enable the “Use Ctrl+Shift+C/V as Copy/Paste” option here, and then click the “OK” button.

在此处启用“使用Ctrl + Shift + C / V作为复制/粘贴”选项,然后单击“确定”按钮。

shell脚本中 bash_如何在Windows 10的Bash Shell中启用复制和粘贴键盘快捷键

You can now press Ctrl+Shift+C to copy selected text in the Bash shell, and Ctrl+Shift+V to paste from your clipboard into the shell.

现在,您可以按Ctrl + Shift + C复制Bash Shell中的选定文本,并按Ctrl + Shift + V从剪贴板粘贴到Shell中。

Because this feature uses the standard operating system clipboard, you can copy and paste to and from other Windows desktop applications. You can even use the new clipboard history feature by pressing Windows+V.

由于此功能使用标准的操作系统剪贴板,因此可以在其他Windows桌面应用程序之间进行复制和粘贴。 您甚至可以通过按Windows + V使用新的剪贴板历史记录功能

Windows remembers this setting, but only for the current shortcut. So, if you launched an Ubuntu shell from a taskbar shortcut, the keyboard shortcuts will automatically be enabled when you launch Ubuntu from that taskbar shortcut once again.

Windows会记住此设置,但只会记住当前的快捷方式。 因此,如果您从任务栏快捷方式启动Ubuntu外壳程序,则再次从该任务栏快捷方式启动Ubuntu时,键盘快捷方式将自动启用。

However, if you launch Ubuntu from a Start menu shortcut or launch another Linux distribution from a different shortcut, the Bash shell window will open with the keyboard shortcuts disabled. You can enable keyboard shortcuts for the new window and that setting will be remembered for whatever shortcut you launched.

但是,如果您从“开始”菜单快捷方式启动Ubuntu或从其他快捷方式启动另一个Linux发行版 ,则Bash shell窗口将在禁用键盘快捷方式的情况下打开。 您可以为新窗口启用键盘快捷键,并且您启动的任何快捷键都会记住该设置。

shell脚本中 bash_如何在Windows 10的Bash Shell中启用复制和粘贴键盘快捷键

This new option is actually part of the Windows console environment and not just the Windows Subsystem for Linux. This means you can also enable these shortcuts for other console environments, such as the Command Prompt and PowerShell. However, you can already copy and paste in those applications with the standard Ctrl+C and Ctrl+V shortcuts thanks to the “Enable Ctrl key shortcuts” option.

这个新选项实际上是Windows控制台环境的一部分,而不仅仅是Linux的Windows子系统。 这意味着您还可以为其他控制台环境启用这些快捷方式,例如命令提示符和PowerShell。 但是,借助“启用Ctrl键快捷键”选项,您已经可以使用标准的Ctrl + C和Ctrl + V快捷键复制和粘贴这些应用程序。

The “Enable Ctrl key shortcuts” option is on by default, but it doesn’t work in the Linux Bash shell environment. That’s because Ctrl+C sends an interrupt signal, telling the current process to terminate. Ctrl+V performs a “verbatim insert,” causing the next key combination you press to be inserted rather than processed by the terminal. These new keyboard shortcuts provide a functional alternative.

默认情况下,“启用Ctrl键快捷方式”选项处于启用状态,但在Linux Bash Shell环境中不起作用。 这是因为Ctrl + C会发送一个中断信号,告知当前进程终止。 Ctrl + V执行“普通插入”,使您按下的下一个按键组合被插入而不是由终端处理。 这些新的键盘快捷键提供了功能上的选择。

翻译自: https://www.howtogeek.com/353200/how-to-enable-copy-and-paste-keyboard-shortcuts-in-windows-10s-bash-shell/

shell脚本中 bash