在 Ubuntu 20.04 上,我的 gedit 3.36.2 版本带有一个用于查找和替换的正则表达式复选框,无需安装任何插件即可开箱即用。使用哪种正则表达式风格?
在 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
问题
Gedit 说我的一个使用 UTF-8 编码的文件包含无效字符,如果我继续使用它可能会损坏。
细节
有问题的文件是我的 Someday/Maybe List。我通常会在其中添加指向我想阅读的资源的链接,例如博客文章。我怀疑我添加的其中一个来源的链接包含无效字符,导致了我的问题。
我发现这里需要运行 isutf8,然后使用 xxd 或 hexdump 来扫描文件中的无效字符。运行 isutf8 是没有意义的,因为如果这个页面是正确的,它所做的只是告诉你文件是否包含无效字符。我已经阅读了一些关于 xxd 的联机帮助页,以及关于 hexdump 的其他资源,但我什么都不懂。
我试过的
不多。我担心如果我编辑它可能会破坏文件或其他东西,所以我保持不变。此外,我的研究能力很差,所以我自己也找不到解决办法。
我在 Linux 16.04 上分析了我的 *.fasta 文件。我想查看 *.fasta 文件的内容。所以我运行以下命令:
gedit SRR662431.fasta
阅读内容的进度将开始,但一段时间后 gedit 将关闭,我在终端中看到以下消息:
(gedit:10466): Gtk-CRITICAL **: _gtk_text_line_char_locate: assertion 'char_offset >= 0' failed
(gedit:10466): Gtk-ERROR **: Char offset -2147483648 is off the end of the line
Trace/breakpoint trap (core dumped)
如果您指导我解决此问题,我将不胜感激。
每当我打开一个非常大的文本文件(我说的是 10 万行或更多)时,gedit 的背景颜色会从白色变为黑色,这使得黑色文本几乎无法阅读。
这是gedit的错误吗?我能做些什么来阻止它变成黑色背景?
如果我gedit -w -s
从终端运行,则会出现错误:
(gedit:47653): GLib-GIO-CRITICAL **: 12:20:04.475: g_dbus_action_group_get: assertion 'bus_name != NULL || g_dbus_connection_get_unique_name (connection) == NULL' failed
Segmentation fault (core dumped).
如果我在gedit
没有终端参数的情况下运行,它会成功启动。我的 Ubuntu 版本是 20.04.1 LTS Focal Fossa。在以前的 Bionic Beaver 版本的 Ubuntu 中gedit -w -s
运行时没有错误。
目前每次我尝试运行 gedit 我都会收到以下错误:
** (gedit:42831): WARNING **: 17:39:58.054: Default style scheme 'pop-light' cannot be found, falling back to 'classic' style scheme
** (gedit:42831): WARNING **: 17:39:58.058: Loading metadata failed: The specified location is not mounted
我之前确实运行过 Pop!_OS 主题,但这是我在切换回默认设置并删除 Pop!_OS 主题时开始遇到的错误。
当我使用gedit
inUbuntu 20.04
时,每当我单击 中的任何复选框时Preferences
,都不会发生任何事情。
例如,当我单击 时Display line numbers
,该复选框仍标记为已选中。出于某种原因,点击Display grid pattern
、Enable text wrapping
、 和Do not split words over two lines
可以,但是当我退出Preferences
并重新进入时,它们会回到原来的状态,如图所示。
其他选项卡中的所有其他选项都无法更改。
编辑:作为普通用户使用时显然Preferences
有效,而不是root用户。gedit
以前,我试图更改Preferences
为 root
现在,我想知道为什么 Preferences 不能以 root 身份更改。我注意到,当我gedit
以普通用户身份使用时,终端上没有弹出任何内容,但是当我gedit
以 root 身份打开时,终端中会显示以下消息:
(gedit:2024): dconf-WARNING **: 21:01:08.260: failed to commit changes to dconf: The connection is closed
(gedit:2024): dconf-WARNING **: 21:01:08.270: failed to commit changes to dconf: The connection is closed
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
(gedit:2024): dconf-WARNING **: 21:01:08.509: failed to commit changes to dconf: The connection is closed
(gedit:2024): dconf-WARNING **: 21:01:08.509: failed to commit changes to dconf: The connection is closed
(gedit:2024): dconf-WARNING **: 21:01:08.510: failed to commit changes to dconf: The connection is closed
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
(gedit:2024): dconf-WARNING **: 21:04:00.840: failed to commit changes to dconf: The connection is closed
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)