【发布时间】:2012-06-21 23:34:29
【问题描述】:
为了记录,我使用的是 OSX 雪豹。
当我直接从终端使用 emacs 时,我有一个我非常满意的颜色集(例如用于 c/c++)——黑色上的绿色、红色 cmets、彩色关键字......等等。其中一些是在我的“终端首选项”中设置的,有些在我的 ~/.emacs 文件中(见下文)。当我从屏幕运行 emacs 时,基本的配色方案是相同的(黑底绿),但颜色不同(例如,注释字符是红色的,但不是整个 cmets)——真的很烦人。
任何帮助将不胜感激!
在我的“.emacs”文件中(这在 gnu-screen emacs 中停止工作):
(global-font-lock-mode t)
(custom-set-faces
'(font-lock-comment-face
((((class color) (background light))
:foreground "tomato")
)))
在我的“.screenrc”文件中:
shell -$SHELL # colors still don't work without this
#term xterm-256color # using this doesn't fix the colors (suggested on some forums)
altscreen on
startup_message off
我认为我的 .screenrc 文件中的命令 'shell -$SHELL' 使屏幕中的命令提示符与默认值相同 --- 它确实使我的命令行显示为 'computername: /DIR/ username$' 而不是 'bash-3.2$'
================================================ ===================
解决方案:感谢 Greg E.
我需要在屏幕上设置我的终端模拟器以匹配我的普通 shell。为此,我添加了
export TERM='xterm-color'
到 ~/.bash_profile
由于某种原因,“~/.screenrc”文件中的“term xterm-color”不起作用。
【问题讨论】:
-
注意:在 Mac OS X 10.7 Lion 及更高版本上,不建议使用
xterm-color。它代表了 xterm 的一个较旧的分支。在 Lion 中,Terminal 与现代 xterm 足够兼容,您应该使用xterm-256color(默认)或变体,例如xterm-16color。 -
感谢@ChrisPage 的提示
标签: macos emacs colors terminal gnu-screen