ubuntu下Vim配色方案Solarized的配置

系统:ubuntu 12.04 LTS

vim版本:7.4

--------------------------------------------------------------------------------------------------------------------------

先去下载配色方案solarized。 把colors文件夹放到~/.vim目录下。

编辑~/.vimrc,做如下的添加:

syntax enable
if has('gui_running')
    set background=light
else
    set background=dark
endif
set t_Co=16
colorscheme solarized

但是,在ubuntu下面的终端中配色方案不正常 。所以还要做一点配置,让终端的配色方案与vim的一致。

home目录下新建一个叫solarized.sh的文件,编辑它,添加如下代码:

#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
# 
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
 
case "$1" in 
	"dark")
		PALETTE="#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3"
		BG_COLOR="#00002B2B3636"
		FG_COLOR="#65657B7B8383"
		;;
	"light")
		PALETTE="#EEEEE8E8D5D5:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#070736364242:#FDFDF6F6E3E3:#CBCB4B4B1616:#9393A1A1A1A1:#838394949696:#65657B7B8383:#6C6C7171C4C4:#58586E6E7575:#00002B2B3636"
		BG_COLOR="#FDFDF6F6E3E3"
		FG_COLOR="#838394949696"
		;;
	*)
	echo "Usage: solarize [light | dark]"
	exit
	;;
esac
 
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "$PALETTE"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "$BG_COLOR"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "$FG_COLOR"

solarized.sh添加执行权限: chmod +x solarized.sh

最后,在终端下运行./solarized.sh dark ./solarized.sh light

这样,终端的配色方案与vim中的配色一致了。


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值