将 urxvt 设置为使用 256 种颜色

ma0*_*a08 16 colors xterm rxvt urxvt

我花了很多时间来尝试urxvt使用 256 种颜色。我正在使用 Ubuntu。我关注了这篇文章的一部分

cd ~
infocmp -L rxvt-unicode > rxvt-unicode.terminfo

vi rxvt-unicode.terminfo
# Change the following from:
#
#    lines_of_memory#0, max_colors#88, max_pairs#256,
#
# to:
#
#    lines_of_memory#0, max_colors#256, max_pairs#32767

# Make .terminfo dir if you don't already have it
install -d .terminfo

# Rebuild terminfo for rxvt-unicode
tic -o .terminfo/ rxvt-unicode.terminfo

# Cleanup
rm rxvt-unicode.terminfo
Run Code Online (Sandbox Code Playgroud)

tput colors现在给出 256 而不是之前的 88 但是当我运行256colors2.pl脚本时,输出并不像预期的那样。 这是屏幕截图

echo $TERMrxvt-unicode在urxvt输出。

echo $COLORTERMrxvt-xpm在 vim 中作为输出给出。

echo &t_Co 在 vim 中给出 256 作为输出。

请帮我弄清楚如何为 urxvt 设置 256 种颜色。我的主要目标是在 gruvbox 主题中使用 vim(在终端中)。

对答案的回应:

我已经t_Co=256在 vim 中设置了该选项。我不使用 tmux。使用它不会改变256colors2.pl脚本的结果。tmux 中的 TERM 已经设置为screen-256color. 我尝试复制/usr/share/terminfo/r/rxvt-256color~/.terminfo/r/rxvt-256color. TERM 或测试结果没有变化。最后我用了colortest CJD14 有链接,很多颜色都不行。只有一堆颜色被着色。所以肯定有东西坏了或配置错误。

ma0*_*a08 21

是的,终于发现我的错误了。似乎您需要安装该软件包rxvt-unicode-256color才能获得 256 色支持。

sudo apt-get install rxvt-unicode-256color
Run Code Online (Sandbox Code Playgroud)

是我的问题的答案。