讓 Terminal/vim 使用 Solarized 配色
經過親身體驗,終於使用上了solarized的配色,之前配出來相差太多,於是找到這篇參考博文:http://blog.csdn.net/angle_birds/article/details/11694325
終於成功了,不容易呀,本人使用的是Ubuntu 12.04.1,可以看看的去體驗了
下面談談具體操作
在終端裡邊啟動vim,終端的配色會影響vim的配色;vim的配色是疊加到終端的顏色上的,所以很多時候對vim的配色都和設想的不一樣。
線上配色網址: http://bytefluent.com/devify/ ,配置完成後,可以下載配置檔案。
1.先改終端的配色為Solarized
現在基本用 ubuntu 做開發,直接在終端(gnome-terminal)裡面 vim,但配色效果不甚滿意,因為 gvim 的配色是 Solarized,google 告訴我 Gnome-Terminal 也可以這樣配。可以先圍觀下效果圖:
首先安裝 git:sudo apt-get install git-core
然後要設一下 solarized theme for GNU ls,不然在 Terminal 下 ls 啥的都灰濛濛的,也不舒服:
git clone git://github.com/seebi/dircolors-solarized.git
dircolor-solarized 有幾個配色,你可以去專案那看看說明,我自己用的是 dark256:
cp ~/dircolors-solarized/dircolors.256dark ~/.dircolors eval 'dircolors .dircolors'
設定 Terminal 支援 256 色,vim .barshrc
並新增 export TERM=xterm-256color
,這樣 dircolors for GNU ls 算設定完成了。
別忘了先 source .bashrc 。
接下來下載 Solarized 的 Gnome-Terminal 配色:
git clone git://github.com/sigurdga/gnome-terminal-colors-solarized.git 下載完成後執行如下命令 cd gnome-terminal-colors-solarized 到該目錄下執行配色指令碼:./set_dark.sh 或./set_light.sh
。。。。。。。這就算搞定了。
(這裡還有一個修改自 sigurdga 這個 Solarized 配色的,就是背景色跟 solarized 的稍微不一樣,專案地址是:https://github.com/coolwanglu/gnome-terminal-colors-solarized)這個沒試,或許是gnome-terminal-colors-solarized的不同版本吧!
2.改完終端的配色,再改VIM的配色,只要把 solarized.vim
複製到 ~/.vim/plugin/ 目錄下就可以了。(博主這裡是 ~/.vim/plugin/,但試過提示錯誤,然後我把它放在 ~/.vim/colors/中就可以了)
.vimrc 裡邊加上:
syntax enable set background=dark colorscheme solarized
下載地址:
git clone git://github.com/altercation/vim-colors-solarized
不出意外的話就大功告成了。。。。。。。。。。。。。。
本人英語不好,下面也沒看,但是為尊重博主的成果,也將其貼上過來,以參考
Theme #1: "256dark" (by seebi)
- 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
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.
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
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: