linux - 如何在 Ubuntu 或 Pop OS 中通过右键单击添加 "Open with Code"?

标签 linux ubuntu visual-studio-code

在 Windows 操作系统中,当我们安装 VS-Code 时,会向我们提供添加“使用代码打开”的选项。但我在 Ubuntu 或 Pop-OS 中找不到它!
因此,我想知道,当我在文件夹中右键单击以在 VS-Code 中打开文件夹时,有什么方法可以添加“使用代码打开”?
虽然,我们可以使用终端在 VS-Code 中使用“code”打开目录。但我正在寻找鼠标右键。

最佳答案

您可以在 ~/.local/share/applications/mimeapps.list 中手动记下与 vscode 关联的 MIME 类型。像这样

[Added Associations]
text/html=code.desktop
text/css=code.desktop
text/javascript=code.desktop
假设你有一个合适的 Desktop Entry里面 /usr/share/applications/
你也可以试试这个Nautilus扩展名(如果您使用 Nautilus )
https://github.com/harry-cpp/code-nautilus
如果您使用 bash,这将安装它
wget -qO- https://raw.githubusercontent.com/harry-cpp/code-nautilus/master/install.sh | bash

关于linux - 如何在 Ubuntu 或 Pop OS 中通过右键单击添加 "Open with Code"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66483057/

相关文章:

python - 如何在 Ubuntu 中全局限制 python 对内核的使用?

ubuntu - 可以在 Google Chrome OS 中下拉到 Ubuntu 吗?

linux - 在 Ubuntu-16.04 上从源代码安装 gcc-4.8.1

ecmascript-6 - 在 Visual Studio Code 中使用 babel 调试 mocha 测试

php - VS Code PHP 格式化程序 Intelephense

c++ - sd_journal_send 发送二进制数据。如何使用 journalctl 检索数据?

linux - awk 不打印分隔符

linux - 简单的 Shell 脚本不会附加到文件

visual-studio-code - vscode 全局键盘快捷键覆盖扩展

linux - 将 awk 结果存储为 bash ${} 数据格式