前言
zsh(The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting).通俗的说就是:zsh是一个包装了bash终端的终端,对用户很友好。下面是友好的展示:
比之前的颜色好看多了,Terminal也不再是那么的单调的色彩了,在git项目上也能展示分支,并且根据颜色展示分支的状态了(当然,你得配置git插件.绿色:已经commit,黄色:已经add,但是还没commit等等)
安装(只说Linux或者类Linux的操作系统{Max,Unix这种})
1.安装zsh
操作系统 | 安装方式 | 备注 |
---|---|---|
MacOS | brew install zsh zsh-completions | MacOS安装了Homebrew的 |
MacOS | sudo port install zsh zsh-completions | MacOS没有安装Homebrew的 |
Ubuntu | sudo apt-get install zsh | |
Debian | sudo apt-get install zsh | Debian及其衍生系统也行 |
OpenSUSE | zypper install zsh | |
Arch Linux | pacman -S zsh | |
Void Linux | xbps-install zsh | |
Fedora | dnf install zsh | |
OpenBSD | pkg_add zsh | |
FreeBSD | pkg install zsh | |
Centos/RHEL | sudo yum update && sudo yum -y install zsh |
详细请查看:github.com/ohmyzsh/ohm…
还有一种方式:
通过源码,编译的方式。源码地址:http://zsh.sourceforge.net/Arc/source.html,看着这篇文章来安装:http://zsh.sourceforge.net/FAQ/zshfaq01.html#l7
2.设置bash为zsh
一般我们的bash是这个路径:/bin/bash (使用:echo $SHELL 命令可以看到bash的路径)
chsh -s $(which zsh) ----使用这个命令修改我们的默认bash为zsh
注意:修改之后需要登出来logout(不是lock),或者重启也行
3.安装Oh my zsh
第一种方式:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
第二种方式:
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
4.配置Oh my zsh
vi ~/.zshrc
plugins=(
git
bundler
dotenv
osx
rake
rbenv
ruby
)
ZSH_THEME="agnoster"
##修改这两个地方就行了
详细请查看:github.com/ohmyzsh/ohm…
5.安装Powerline字体
第一种安装方式:(Debian or Ubuntu based Linux distribution)主要是Debain衍生的系统
sudo apt-get install fonts-powerline
第二种安装方式:主要是fedora类型
sudo dnf install powerline-fonts
第三种安装方式:直接从源码拉取安装
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
详细请查看:github.com/powerline/f…
问题
1.如果设置了Terminal不起作用?
登出或者重启都行
2.Idea的Terminal有点乱码?
首先:查看Settings->Terminal->Applications Settings->Shell Path是否设置成zsh的路径
接着去查看Console Font的设置Settings->Editor->Color Scheme->Color Scheme Fount->