Visual Studio Code 如何从终端复制彩色语法

发布于 2025-01-18 02:19:13 字数 305 浏览 3 评论 0原文

我在 Linux Ubuntu(虚拟机上)上运行 Visual Studio Code。主机是Windows 10。

似乎VSC for Linux Ubuntu为终端输出提供了一些默认的语法突出显示(至少我不记得我为此安装了任何扩展),如下所示: vsc_bash

如何将终端输出复制到 Microsoft Word/Outlook(在主机上)并保持这种颜色和格式?要复制终端输出,我只需使用右键单击鼠标,然后复制

I am running Visual Studio Code on Linux Ubuntu (on virtual machine). The host machine is Windows 10.

Seems VSC for Linux Ubuntu offers some default syntax highlighting for terminal output (at least I do not remember that I have installed any extension for this), as follows:
vsc_bash

How to copy terminal output to Microsoft Word/Outlook (on host machine) keeping this colourization and formatting? To copy terminal output I am just using right click mouse and then Copy

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半城柳色半声笛 2025-01-25 02:19:13

在 v1.66 中,请参阅发行说明

复制的文本保留 HTML 样式

要从终端复制富文本,请运行终端:将文本复制为 HTML 命令或使用终端上下文菜单项将文本复制为
HTML。

但是实际的命令是:

Terminal: Copy Selection as HTML`

您必须先选择所需的文本,然后触发命令。

默认未绑定,命令为workbench.action.terminal.copySelectionAsHtml

您还可以右键单击并选择复制为 HTML

In v1.66, see the release notes

Copied text retains HTML styling

To copy rich text from the terminal, run the Terminal: Copy text as HTML command or use the terminal context menu entry Copy text as
HTML.

BUT the actual command is:

Terminal: Copy Selection as HTML`

You have to select your desired text first and then trigger the command.

It is unbound by default, the command is workbench.action.terminal.copySelectionAsHtml.

You can also right-click and choose Copy as HTML.

copy as HTML in terminal

烟织青萝梦 2025-01-25 02:19:13

这是一个较晚的答案,但我也为此而苦苦挣扎,只是解决了答案。

首先,您需要将此设置editor.pasteas.enabled设置为true。

第二个选择终端中的文本,然后右键单击 - > 将其复制为HTML

第三,您需要使用命令粘贴为...,默认情况下只能从命令调色板中获得。

This is a late answer but I too have struggled with this and only just worked out the answer.

First you need to set this setting editor.pasteAs.enabled to true.

Second select text in the terminal and right click -> Copy as HTML.

Third you need to use the command Paste As ... which is only available from the command palette by default.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文