When I run nvim in gnome-terminal its color schema works as expected:
But after launching the screen, the color schema is broken (it’s not disabled/gone, it just colors everything incorrectly):
Some more examples of python script:
If I actually change :colorscheme elflord
, it will look like this:
NOTE: notice that elflord breaks colorscheme completely in case of nvim in screen.
Other similar questions are on StackOverflow and the usual suspects are $TERM, $XTERM, etc. In this case, I have a suspicion it’s more related to Ubuntu 24.04. Initially, it was working till about the end of August 2024 when after a regular sudo apt upgrade
it stopped coloring properly. I am not 100% certain it was caused by an upgrade
but on my other PC I installed Ubuntu 24.04 in September 2024 and it never worked there.
Other bits and pieces of the information.
:checkhealth
of nvim without screen:
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
:checkhealth
of nvim with screen:
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
echo $TERM
xterm-256color
for gnome-terminal
screen.xterm-256color
for screen in gnome-terminal
cat ~/.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}]'
In addition I tried:
- downgrading nvim to 0.9.x (and using regular
sudo apt install neovim
) - exporting hardcoded $TERM in .bashrc and .screenrc
- a lot of googling if someone reported something similar for screen, neovim, ubuntu 24.04
- changing termcapinfo into many different things in .screenrc