让 Terminal/vim 使用 Solarized 配色
在终端里边启动vim,终端的配色会影响vim的配色;vim的配色是叠加到终端的颜色上的,所以很多时候对vim的配色都和设想的不一样。
在线配色网址: http://bytefluent.com/devify/ ,配置完成后,可以下载配置文件。
现在基本用 ubuntu 做开发,直接在终端(gnome-terminal)里面 vim,但配色效果不甚满意,因为 gvim 的配色是 Solarized,google
告诉我 Gnome-Terminal 也可以这样配。可以先围观下效果图:
首先安装 git:sudo
apt-get install git-core
然后要设一下 solarized
theme for GNU ls,不然在 Terminal 下 ls 啥的都灰蒙蒙的,也不舒服:
dircolor-solarized 有几个配色,你可以去项目那看看说明,我自己用的是 dark256:
eval 'dircolors .dircolors'
设置 Terminal 支持 256 色,vim
并添加
.barshrcexport
,这样 dircolors for GNU ls 算设置完成了。
TERM=xterm-256color
别忘了先 source .bashrc 。
接下来下载 Solarized 的 Gnome-Terminal 配色:
cd
到该目录下运行配色脚本:
gnome-terminal-colors-solarized./set_dark.sh
或./set_light.sh
,这就算搞定了。
这里还有一个修改自 sigurdga 这个 Solarized 配色的,就是背景色跟 solarized 的稍微不一样,项目地址是:https://github.com/coolwanglu/gnome-terminal-colors-solarized
2.改完终端的配色,再改VIM的配色,只要把 solarized.vim
复制到 ~/.vim/plugin/ 目录下就可以了。
.vimrc 里边加上:
syntax enable
set background=dark
colorscheme solarized
下载地址:
https://github.com/altercation/vim-colors-solarized
Theme #1: "256dark" (by
seebi)
Features / Properties
- Solarized
- Comment style for backup and log and cache files
- Highlighted style for files of special interest (.tex, Makefiles, .ini ...)
- Bold hierarchies:
- archive = violet, compressed archive = violet + bold
- audio = orange, video = orange + bold
- Tested use-cases:
- latex directories
- source code directories
- Special files (block devices, pipes, ...) are inverted using thesolarized light palette for the background
- Symbolic links bold and distinguishable from directories
Screenshots
Here is a
1920pxx1200px screenshot of a prepared
tmux-session.It is captured from a
gnome-terminal using the
dz-version of the awesome Inconsolata font but you can use any
libvte based terminal emulator (and other emulator which support 256colors).I recently switched tosakura and my decision was based onthis
comparison and the priming that the gnome-terminal was too slow and too fat.
- upper left - Common colors in action: Executables, archives, audio/video stuff, dead links
- lower left - latex directory: tex-trash is in comment style and tex are main files of interest and highlighted
- upper right and thereunder - source directories: all source files are standard highlighted, makefiles, configuration files and READMEs are of special interest, and object and class files are commented out.
- lower right - all colors in action, uncommon stuff like pipes and block devices
Some more screenshots are provided by
andrew from webupd8.org.
Theme #2: "ansi-\*" (byhuyz)
This theme and its variants require that the terminal emulator be properlyconfigured to display the Solarized palette instead of the 16 default ANSIcolors.
Features / Properties
This theme called "ansi-universal" and its variants "ansi-dark" and"ansi-light", were designed to work best with both Solarized Dark and Lightpalettes, but also to work under terminals' default ANSI colors. In otherwords, these
themes were designed with a "fallback" scenario: if you happen tofind yourself on a terminal where the Solarized palette has not been set up,you won't have elements become invisible, incrediby hard to read, or a boringgray.
Thus, the universal theme was designed with these 4 palettes in mind:
- Solarized Dark: "ansi-universal" works best when the terminal emulator isset to this scheme
- Solarized Light: "ansi-universal" works best when the terminal emulator isset to this scheme
- Default terminal ANSI Colors with a dark background
- Default terminal ANSI Colors with a light background
The "ansi-dark" and "ansi-light" are slightly optimized versions of "ansi-universal"for Solarized Dark and Solarized Light, respectively, if you're willingto sacrifice a bit of universality.
Colors were selected based on the characteristics of the items to be displayed:
- Visibility generally follows importance, with an attempt to let unimportantitems fade into the background (which is not always possible whensimultaneously supporting dark and light backgrounds)
- Loud colors are chosen to call attention to noteworthy items
Screenshots
Solarized Dark (this example uses iTerm2 on OS X):
To see what this theme looks like when the terminal emulator is set with different color palettes: