Ubuntu 24.04下Screen环境中Neovim配色异常求助
问题:Screen环境下Neovim配色异常(Ubuntu 24.04)
现象对比
- 直接在gnome-terminal运行Neovim:配色方案工作正常

- 启动Screen后运行Neovim:配色显示全部错误(并非完全失效)

Python代码编辑场景对比
- 纯gnome-terminal中编辑Python代码:

- Screen内编辑Python代码:

elflord配色方案表现
- 纯gnome-terminal中使用elflord配色:

- Screen内使用elflord配色:完全失效

问题背景
该问题疑似与Ubuntu 24.04相关:原本功能正常,2024年8月底执行sudo apt upgrade后出现异常;另一台2024年9月全新安装Ubuntu24.04的设备从未正常工作过。类似问题通常与$TERM、$XTERM等终端环境变量相关。
附加信息
无Screen时Neovim的:checkhealth结果
77 nvim: require("nvim.health").check() 78 79 Configuration 80 - OK no issues found 81 82 Runtime 83 - OK $VIMRUNTIME: /squashfs-root/usr/share/nvim/runtime 84 85 Performance 86 - OK Build type: Release 87 88 Remote Plugins 89 - OK Up to date 90 91 terminal 92 - key_backspace (kbs) terminfo entry: key_backspace=\177 93 - key_dc (kdch1) terminfo entry: key_dc=\E[3~ 94 - $VTE_VERSION="7600" 95 - $COLORTERM="truecolor" 96 97 External Tools 98 - WARNING ripgrep not available
有Screen时Neovim的:checkhealth结果
77 nvim: require("nvim.health").check() 78 79 Configuration 80 - OK no issues found 81 82 Runtime 83 - OK $VIMRUNTIME: /squashfs-root/usr/share/nvim/runtime 84 85 Performance 86 - OK Build type: Release 87 88 Remote Plugins 89 - OK Up to date 90 91 terminal 92 - key_backspace (kbs) terminfo entry: key_backspace=\177 93 - key_dc (kdch1) terminfo entry: key_dc=\E[3~ 94 - $VTE_VERSION="7600" 95 - $COLORTERM="truecolor" 96 97 External Tools 98 - WARNING ripgrep not available
$TERM变量值
- gnome-terminal中:
xterm-256color - Screen内:
screen.xterm-256color
~/.screenrc配置内容
# /etc/screenrc encoding UTF-8 startup_message off vbell off # ------------------------------------------------------------------------------ # STARTUP SCREENS # ------------------------------------------------------------------------------ hardstatus alwayslastline hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
已尝试的解决方法
- 将Neovim降级至0.9.x(通过
sudo apt install neovim安装) - 在
.bashrc和.screenrc中硬编码导出$TERM变量 - 搜索是否存在Screen、Neovim、Ubuntu 24.04相关的同类问题
- 在
.screenrc中尝试修改多种不同的termcapinfo配置
内容的提问来源于stack exchange,提问作者Drachenfels
相关产品推荐
相关产品推荐

