如何在 Fedora 17 终端中为 VIM 启用 256 色支持?
我的.bashrc:
1 # .bashrc
2
3 # Makes terminal default 256 Colors Include these lines in .bashrc
4
5 export TERM=xterm-256color
6
7 # User specific aliases and functions
8
9 alias rm='rm -i'
10 alias cp='cp -i'
11 alias mv='mv -i'
12
13 # Source global definitions
14 if [ -f /etc/bashrc ]; then
15 . /etc/bashrc
16 fi
17
Tput 颜色返回 8,我使用 256 个 jellybeans 作为 vim 颜色,它改变了一些颜色,但几乎不起作用,如屏幕截图所示(因为终端只支持 8 种颜色)
提前致谢。
答案1
该脚本来自Fedora 项目网站:
local256="$COLORTERM$XTERM_VERSION$ROXTERM_ID$KONSOLE_DBUS_SESSION"
if [ -n "$local256" ] || [ -n "$SEND_256_COLORS_TO_REMOTE" ]; then
case "$TERM" in
'xterm') TERM=xterm-256color;;
'screen') TERM=screen-256color;;
'Eterm') TERM=Eterm-256color;;
esac
export TERM
if [ -n "$TERMCAP" ] && [ "$TERM" = "screen-256color" ]; then
TERMCAP=$(echo "$TERMCAP" | sed -e 's/Co#8/Co#256/g')
export TERMCAP
fi
fi
unset local256
去测试:
tput colors
输出应该是256