在 centos 上配置 ohmyzsh
安装 zsh
centos 默认不提供 zsh ,因此请根据此文安装
配置 ohmyzsh
安装 ohmyzsh
安装
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
# 看到下面的标志说明安装成功
         __                                     __
  ____  / /_     ____ ___  __  __   ____  _____/ /_
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/
                        /____/                       ....is now installed!
配置主题
使用过很多主题,最终还是觉得 powerlevel10k 的主题非常的丰富,因此选择这个。
手动安装
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
国内用户可以用 gitee 的地址下载
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
进行配置
vim ~/.zshrc
# 修改 ZSH_THEME="powerlevel10k/powerlevel10k"
source ~/.zshrc
然后就进入了样式配置界面,根据个人喜好来配置即可,配置样式不喜欢可以使用 p10k configure 重新配置。
安装插件
我装了如下插件:git、macos、z(跳转)、zsh-autosuggestions(提示)、zsh-syntax-highlighting(高亮)、extract(功能:一键解压所有格式文件,x file_name or extract file_name)
# 下面这行加入 ~/.zshrc
plugins=(git macos z zsh-autosuggestions zsh-syntax-highlighting extract)
安装 zsh-autosuggestions 和 zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
安装后 source ~/.zshrc 使之生效。