如何在ubuntu terminal及vim使用solarized主题

在Ubuntu上实现Solarized主题的完整体验,不仅需要在Vim中安装插件,还必须配置Terminal的主题。本文介绍了如何安装git,从GitHub下载并应用Solarized配色方案,调整ls命令的显示颜色,以及在Vim中设置Solarized主题的详细步骤。

在ubuntu上想使用solarized 主题的vim,仅仅是安装solarized插件是不够的,需要同时对ubuntu的terminal的主题也做solarized的配置。

说明:ubuntu中如果只修改vim使用solarized配色,会因terminal配色和vim配色叠加造成亮灰色,因此terminal也需要修改成solarized配色:

##1.如果没有安装git,先通过sudo apt-get install git-core安装git
##2.从github上下载配色方案

git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git

进入gome-terminal-colors-solarized后,运行./set_dark.sh或./set_light.sh
这里写图片描述

##3.此时ls 命令的话会看到显示都是白色,接着我们来修改ls 的配色
先从solarized项目中下载配色文件

git clone https://github.com/seebi/dircolors-solarized.git

下载完后会有256dark,ansi-dark,ansi-light等多个配色,这里用256dark
执行cp ~/dircolors-solarized/dircolors.256dark ~/.dircolors,复制后的.dircolors就是待会要读取的ls配色文件
在./bashrc文件中加入 eval dircolors ~/.dircolors ,每次启动bash读取配色文件,接着我们关闭打开另一个bash,此时ls命令可以看到有颜色了

##4.接着我们来对vim进行配色,通过

git clone https://github.com/altercation/vim-colors-solarized.git

下载vim solarized主题,复制vim-colors-solarized/colors/下的solarized.vim到/usr/share/vim/vim74目录下,注意solarized.vim的权限,然后在~/.vimrc中添加几句

syntax enable
let g:solarized_termcolors=256
set background=dark
colorscheme solarized

这样就配置完成,最终效果如下图:
这里写图片描述

下面是在ubuntu16.04上执行set_dart.sh的log:

jack@jack-VirtualBox:~/gnome-terminal-colors-solarized$ ./set_dark.sh 

This script will ask you which color scheme you want, and which Gnome Terminal profile to overwrite.

Please note that there is no uninstall option yet. If you do not wish to overwrite any of your profiles, you should create a new profile before you run this script. However, you can reset your colors to the Gnome default, by running:

    Gnome >= 3.8 dconf reset -f /org/gnome/terminal/legacy/profiles:/
    Gnome < 3.8 gconftool-2 --recursive-unset /apps/gnome-terminal

By default, it runs in the interactive mode, but it also can be run non-interactively, just feed it with the necessary options, see 'install.sh --help' for details.

Please select a Gnome Terminal profile:
1) Unnamed
#? 1

You have selected:

  Scheme:  dark
  Profile: Unnamed (b1dcc9dd-5262-4d8d-a863-c897e6d979b9)

Are you sure you want to overwrite the selected profile?
(YES to continue) YES
Confirmation received -- applying settings

A dircolors adapted to solarized can be automatically downloaded.

1) Download seebi' dircolors-solarized: https://github.com/seebi/dircolors-solarized

2) [DEFAULT] I don't need any dircolors.

Enter your choice : [2] 2
jack@jack-VirtualBox:~/gnome-terminal-colors-solarized$ ls
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JXES智能生态系统

如文章对你有用,请作者喝个咖啡

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值