安装 zsh

下载

查看所有的 shell

cat /etc/shells

安装 zsh

sudo apt install zsh

把 zsh 设为默认的 shell

chsh -s /bin/zsh

安装 oh my zsh

已经把 github 源替换为了 gitee,并且可以自动的选择软件镜像源,非常的方便!

sh -c "$(wget https://gitee.com/Devkings/oh_my_zsh_install/raw/master/install.sh -O -)"

如果要通过 github 安装,就用

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装插件

zsh-autosuggestions 和 zsh-syntax-highlighting

git clone https://gitee.com/githubClone/zsh-autosuggestions  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://gitee.com/ponponon/zsh-syntax-highlighting  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

如果要通过 github 安装,就用

# 语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# 自动建议
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

常用

插件

写到 ~/.zshrc 文件中

alias ll='ls -alF'


plugins=(
git
zsh-autosuggestions
)

主题

ZSH_THEME="gnzh"

最后的效果

图片.png

会五颜六色,会显示当前路径,然后如果你在 git 路径下,还会显示当前分支

扩展文章:
macOS 中 zsh 配置文件及其加载顺序
Files
切换用户后,/etc/profile的配置不起效


rabbitcoder
3.5k 声望868 粉丝