mac 一般会自带 zsh
如果没有zsh,可以直接安装
brew install zsh
~ » cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
-------------
默认是bash
需要切换到zsh
chsh -s /bin/zsh
<
echo $SHELL
~ » echo $SHELL
/bin/zsh
然后安装 oh my zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us at https://twitter.com/ohmyzsh.
p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.
会看到上面的图标
做一些配置
主题 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
选择一种喜欢的主题
打开配置文件进行修改
open ~/.zshrc
ZSH_THEME="af-magic"
plugins=(git osx autojump zsh-autosuggestions zsh-syntax-highlighting)
plugins添加插件,高亮显示和自动提示
其中 zsh-autosuggestions 和 zsh-syntax-highlighting 是自定义安装的插件,需要用 git 将插件 clone 到指定插件目录下:
# 自动提示插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# 语法高亮插件
git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
source ~/.bash_profile
加这个是因为每次重新打开zsh终端,.bash_profile的环境变量会失效
加这个就会每次生效,不用每次去手动source
source ~/.zshrc
然后把终端显示字体调大点
整个终端使用起来就非常舒服了
参考文章:
https://www.jianshu.com/p/d194d29e488c
转载请注明:汪明鑫的个人博客 » MAC终端神器 zsh
说点什么
您将是第一位评论人!