![帮助配置“mimeapps.list”以打开 gedit 而不是 gnome-text-editor?](https://linux22.com/image/1029937/%E5%B8%AE%E5%8A%A9%E9%85%8D%E7%BD%AE%E2%80%9Cmimeapps.list%E2%80%9D%E4%BB%A5%E6%89%93%E5%BC%80%20gedit%20%E8%80%8C%E4%B8%8D%E6%98%AF%20gnome-text-editor%EF%BC%9F.png)
在 Ubuntu 23.04 上,我已经安装了 Gedit 和默认文本编辑器(gnome-text-editor)。
我想保留 gnome-text-editor,但我希望大多数文本文件可以在 gedit 中打开。
我已将以下内容添加到~/.config/mimeapps.list
,但它不起作用——如果我*.txt
在 Nautilus 中单击文件,它仍会在 gnome-text-editor 中打开。我在以下文件中做错了什么?
# Separate *.desktop files with a ";"
[Default Applications]
application/octet-stream=org.gnome.gedit.desktop
application/xml=org.gnome.gedit.desktop
application/json=org.gnome.gedit.desktop
text/x-patch=org.gnome.gedit.desktop
application/javascript=org.gnome.gedit.desktop
text/x-csrc=org.gnome.gedit.desktop
text/markdown=org.gnome.gedit.desktop
[Added Associations]
application/octet-stream=org.gnome.gedit.desktop
application/xml=org.gnome.gedit.desktop
application/json=org.gnome.gedit.desktop
text/x-patch=org.gnome.gedit.desktop
application/javascript=org.gnome.gedit.desktop
text/x-csrc=org.gnome.gedit.desktop
# Override R Studio mime types listed in /usr/share/applications/rstudio.desktop
text/x-tex=org.gnome.gedit.desktop
text/x-markdown=org.gnome.gedit.desktop
text/html=org.gnome.gedit.desktop
text/css=org.gnome.gedit.desktop
text/javascript=org.gnome.gedit.desktop
text/x-chdr=org.gnome.gedit.desktop
text/x-csrc=org.gnome.gedit.desktop
text/x-c++hdr=org.gnome.gedit.desktop
text/x-c++src=org.gnome.gedit.desktop
text/markdown=org.gnome.gedit.desktop
答案1
看起来我遗漏了一个非常重要的映射:
text/plain=org.gnome.gedit.desktop
这样就可以在 Gedit 中打开大多数文本文件。
我还添加了几个其他映射(在 Gedit 中打开 XML 和 Python 文件):
application/x-shellscript=org.gnome.gedit.desktop
text/x-python3=org.gnome.gedit.desktop