使用Zsh和Oh-My-Zsh打造超强终端

由于比较喜欢用CentOs但是他的终端太丑了 所以这里加强了一下

  • 安装 Zsh
1
yum -y install zsh
  • 安装 Oh-My-Zsh
1
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
  • 安装字体 防止主题出问题
1
2
3
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
  • 配置主题

    • 可选主题 bullet-train 安装
    1
    wget -O$ZSH_CUSTOM/themes/bullet-train.zsh-theme http://raw.github.com/caiogondim/bullet-train-oh-my-zsh-theme/master/bullet-train.zsh-theme
    • 修改~/.zshrc中的主题配置 改为
    1
    2
    3
    4
    5
    6
    # Set name of the theme to load. Optionally, if you set this to "random"
    # it'll load a random theme each time that oh-my-zsh is loaded.
    # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
    #ZSH_THEME="ys" 字体显示奇怪的可以用这个 挺好的
    #ZSH_THEME="agnoster" 这个主题也还行
    ZSH_THEME="bullet-train"
    • ~/.zshrc中新增
    1
    export TERM=xterm-256color
  • 安装终端配色

1
2
3
git clone git://github.com/sigurdga/gnome-terminal-colors-solarized.git
cd gnome-terminal-colors-solarized
./set_dark.sh
  • 启用Zsh插件 修改~/.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
z
git
extract
kubectl
last-working-dir
zsh-autosuggestions
zsh-syntax-highlighting
)