讓 Terminal/vim 使用 Solarized 配色


在終端里邊啟動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

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

tmux session

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):

Solarized Dark]

To see what this theme looks like when the terminal emulator is set with different color palettes:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM