ubuntu14.04设置terminal配色方案以配合使用vim的Solarized插件

在安装vim插件以前,首先安装Vundle插件,用来管理vim插件,安装方法查看Vundle在github上的指南。在安装vundle的时候出现了一个错误E117:unknown function vundle#installer#new。形成这个的缘由是由于个人.vimrc里面的内容,因此我新建了一个干净的.vimrc文件后就能够了。git

而后去solarized在github上的仓库,按照教程安装solarized。github

solarized插件安装好后,因为终端不支持这些配色方案。因此颜色效果和solarized官方网站截图效果差异很大。ubuntu

此时须要对终端的配色方案进行调整,调整方法参考了Using Solarized colors with vim, Eclipse and Ubuntu这篇文章。vim

Gnome Terminalapp

将下面的代码保存到.sh文件中,eclipse

 1 #!/bin/sh
 2 #
 3 # Shell script that configures gnome-terminal to use solarized theme
 4 # colors. Written for Ubuntu 11.10, untested on anything else.
 5 #
 6 # Solarized theme: http://ethanschoonover.com/solarized
 7 # 
 8 # Adapted from these sources:
 9 # https://gist.github.com/1280177
10 # http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
11 
12 case "$1" in 
13     "dark")
14         PALETTE="#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3"
15         BG_COLOR="#00002B2B3636"
16         FG_COLOR="#65657B7B8383"
17         ;;
18     "light")
19         PALETTE="#EEEEE8E8D5D5:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#070736364242:#FDFDF6F6E3E3:#CBCB4B4B1616:#9393A1A1A1A1:#838394949696:#65657B7B8383:#6C6C7171C4C4:#58586E6E7575:#00002B2B3636"
20         BG_COLOR="#FDFDF6F6E3E3"
21         FG_COLOR="#838394949696"
22         ;;
23     *)
24     echo "Usage: solarize [light | dark]"
25     exit
26     ;;
27 esac
28 
29 gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false
30 gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false
31 gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "$PALETTE"
32 gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "$BG_COLOR"
33 gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "$FG_COLOR"

而后chmod +x solarized.sh赋予执行权限,命令行下执行./solarized dark,参数可选择dark 或者 light。ide

以后再用vim打开文件配色效果就和官网截图的同样了。网站

相关文章
相关标签/搜索