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

前端之家收集整理的这篇文章主要介绍了如何在ubuntu terminal及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@H_301_10@ https://github.com/sigurdga/gnome-terminal-colors-solarized.git@H_301_10@

进入gome-terminal-colors-solarized后,运行./set_dark.sh或./set_light.sh

3.此时ls 命令的话会看到显示都是白色,接着我们来修改ls 的配色

先从solarized项目中下载配色文件

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

下载完后会有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@H_301_10@ https://github.com/altercation/vim-colors-solarized.git@H_301_10@

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

Syntax enable
let@H_301_10@ g:solarized_termcolors=256@H_301_10@
set@H_301_10@ background=dark
colorscheme solarized

这样就配置完成,最终效果如下图:

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

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

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

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

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

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

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

You@H_301_10@ have selected:@H_301_10@

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

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

A@H_301_10@ dircolors adapted to solarized can be automatically downloaded.

1@H_301_10@) Download@H_301_10@ seebi' dircolors-solarized: https://github.com/seebi/dircolors-solarized 2) [DEFAULT] I don'@H_301_10@t need any dircolors.

Enter@H_301_10@ your choice :@H_301_10@ [2@H_301_10@] 2@H_301_10@
jack@jack@H_301_10@-VirtualBox@H_301_10@:~/gnome-terminal-colors-solarized@H_301_10@$ @H_301_10@ls

猜你在找的Ubuntu相关文章