Forked from deneschen/开启xterm终端256色和终端下vim 256色
Last active
December 1, 2018 02:58
-
-
Save unixc3t/28c477d90daeeefbdc41ca9d80f22855 to your computer and use it in GitHub Desktop.
开启xterm终端256色和终端下vim 256色
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
相同的colorschema,vim和gvim的颜色差距还是很大的,因为gvim使用X的颜色,而vim只能使用终端提供的颜色,所以造成了二者的显示差异。 | |
xterm开启256色 | |
现在的终端模拟器早就支持256色了,不过默认可能还是8色的。 | |
开启xterm终端,查看xterm终端支持的颜色 | |
命令: | |
$ tput colors | |
8 | |
xterm终端默认还是8色的 | |
查看终端类型 | |
命令: | |
$ echo $TERM | |
xterm | |
只要将终端类型更改为xterm-256color即可,有两种方式可以来修改 | |
1、修改.bashrc文件 | |
~/.bashrc文件添加 | |
if [ "$TERM" == "xterm" ]; then | |
export TERM=xterm-256color | |
fi | |
修改生效后,重新查看 | |
$ tput colors | |
256 | |
$ echo $TERM | |
xterm-256color | |
vim开启256色支持 | |
编辑~/.vimrc文件,添加 | |
set t_Co=256 | |
t_Co即terminal Color之意 | |
开启256颜色之后,colorschema在vim里好看了许多,而且与gvim显示的差别不大。 | |
参考: | |
http://vim.wikia.com/wiki/256_colors_setup_for_console_Vim | |
http://push.cx/2008/256-color-xterms-in-ubuntu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment