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


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

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

    solarized插件安装好后,由于终端不支持这些配色方案。所以颜色效果和solarized官方网站截图效果差别很大。

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

    Gnome Terminal

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

     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。

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

  • 相关阅读:
    SpringBoot优雅的全局异常处理
    react格式化展示json
    Pycharm调试按钮
    HttpURLConnection和okhttp的使用
    objection自动生成hook代码
    hookString
    python取中位数 位运算
    scrapy mongo pipeline
    xpath tips
    IT日语
  • 原文地址:https://www.cnblogs.com/KarryWang/p/4583436.html
Copyright © 2020-2023  润新知