如何设置Linux X终端,使Emacs可以访问256色?
当我在X终端窗口中运行如何设置Linux X终端,使Emacs可以访问256色?,linux,emacs,colors,xterm,Linux,Emacs,Colors,Xterm,当我在X终端窗口中运行emacs-nw,并要求显示M-X列表颜色时,我得到了一个微不足道的调色板: black red green yellow blue magenta cyan white 我被告知有可能得到265种颜色。将TERM环境变量设置为xterm-256color不起作用。什么功能?除了将term设置为xterm-256color之外,还可以根据
emacs-nw
,并要求显示M-X列表颜色时,我得到了一个微不足道的调色板:
black
red
green
yellow
blue
magenta
cyan
white
我被告知有可能得到265种颜色。将TERM
环境变量设置为xterm-256color
不起作用。什么功能?除了将term
设置为xterm-256color
之外,还可以根据您的需要ncurses term
库
好的,还有一些事情要尝试,比如:
The xterm in Ubuntu Edgy does not advertise 256 color support by
default. To fix this you need to install a 256 color terminfo entry,
and tell xterm to use it:
apt-get install ncurses-term
echo XTerm.termName: xterm-256color \
>>~/.Xdefaults
xrdb -merge ~/.Xdefaults
以及:
So you need a file term/screen-256color.el in your load-path. Emacs
22 expects it to contain a terminal-init-screen defun. Emacs 21
expects it to contain a bunch of top-level forms. Here's what I use:
;;; This is for GNU Emacs 22
(defun terminal-init-screen ()
"Terminal initialization function for screen."
;; Use the xterm color initialization code.
(load "term/xterm")
(xterm-register-default-colors)
(tty-set-up-initial-frame-faces))
;;; This is for GNU Emacs 21
(if (= 21 emacs-major-version)
(load "term/xterm-256color"))
For Emacs 21, you also need to install the xterm-256color.el file from
http://www.splode.com/~friedman/software/emacs-lisp/src/term/xterm-256color.el
当我在谷歌上搜索时,我得到的印象是大多数发行版在打包的终端模拟器中不支持256色
我怀疑如果你继续看,你可能会得出和我一样的结论。最好的答案是下载并编译它自己与所有的铃声和口哨打开
我使用的是vim,因此可能存在其他特定于emacs的依赖项/陷阱,但我非常确定支持256色的终端非常重要。将术语设置为xterm-256color
。另外,Emacs 22(至少)不需要我的任何特殊配置就可以显示256色。看这个。安装了ncurses-term
软件包后,我可以使用我的Ubuntu版本附带的香草xterm在Emacs上获得256色(在本例中为Interpid,但我猜在早期版本上也可以)。我还使用Gnome终端、Konsole和PuTTY获得了256种颜色,值得一提。在Debian测试中,tput颜色显示256种,但emacs仅显示8种。是否需要emacs 22?(它有致命的错误,使我无法使用它。)它不应该是XTerm*termName
-即在XTerm
和termName
之间使用*
,而不是在您的情况下使用
吗?但它是用256色支持编译的吗?