如何设置 Linux X 终端以便 Emacs 可以访问 256 种颜色?
当我在 X 终端窗口中运行 emacs -nw
并请求 Mx list-colors-display
时,我得到了一个微不足道的调色板:
black
red
green
yellow
blue
magenta
cyan
white
我被告知这是可能的获得265种颜色。 将 TERM
环境变量设置为 xterm-256color
不起作用。 有什么作用?
When I run emacs -nw
in an X terminal window, and I ask for M-x list-colors-display
, I am offered a paltry palette:
black
red
green
yellow
blue
magenta
cyan
white
I am told it is possible to get 265 colors. Setting the TERM
environment variable to xterm-256color
does not do the job. What does?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据这个你需要除了将
TERM
设置为xterm-256color
之外,还有ncurses-term
库。好吧,这个还有一些其他的事情可以尝试,例如:
和:
According to this you need
ncurses-term
library in addition to settingTERM
toxterm-256color
.Okay, this has some other things to try like :
and :
将
TERM
设置为xterm-256color
是您想要做的。 另外,Emacs 22(至少)不需要我进行任何特殊配置即可显示 256 种颜色。 请参阅此相关问题。 安装了 ncurses-term 软件包后,我可以使用我的 Ubuntu 版本附带的普通 xterm(在本例中为 Interpid,但我猜它会在 Emacs 上获得 256 种颜色)在早期版本上没问题)。 我还使用 Gnome Terminal、Konsole 和 PuTTY 获得了 256 种颜色,这是值得的。Setting
TERM
toxterm-256color
is what you want to do. Also, Emacs 22 (at least) didn't need any special config from me in order to display 256 colors. See this related question. With thencurses-term
package installed, I was able to get 256 colors on Emacs using the vanilla xterm that came with my version of Ubuntu (Interpid, in this case, but I'm guessing it'll be fine on earlier versions). I also got 256 colors using Gnome Terminal, Konsole, and PuTTY, for what that's worth.当我用 google 搜索这个时,我得到的印象是大多数发行版在打包的终端模拟器中都没有启用 256 色支持。
我怀疑如果你继续寻找,你可能会得出与我相同的结论。 最好的答案是下载 urxvt 并自行编译它口哨声响起。
我使用的是 vim,因此可能存在其他 emacs 特定的依赖项/陷阱,但我很确定支持 256 色的终端很重要。
When I googled this I got the impression that most distros don't enable 256 colour support in the packaged terminal emulators.
I suspect if you keep looking you may come to the same conclusion that I did. The best answer is to download urxvt and compile it yourself with all the bells and whistles turned on.
I was using vim, so there may be other dependencies/gotchas that are emacs specific, but I'm pretty sure a terminal that supports 256 colours is important.