oh-my-zsh 是一个用于管理和配置 zsh 终端的开源框架。它为用户提供了一种更加用户友好和功能丰富的 shell 使用体验。oh-my-zsh 提供了许多有用的特性,包括自动补全、命令历史、插件和自定义的主题等。

zsh安装

#MacOS无需安装,默认使用zsh,Ubuntu安装方式如下
apt install zsh

oh-my-zsh安装

github

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

powerlevel10k主题皮肤安装

github

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

修改配置.zshrc

ZSH_THEME="powerlevel10k/powerlevel10k"

配置生效

source .zshrc

然后根据个人喜好根据提示进行设置。 如果要重新配置,输入命令

p10k configure

安装历史提示插件

github

MacOS

brew install zsh-autosuggestions

修改配置.zshrc

source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh

配置生效

source .zshrc

Ubuntu

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

修改配置.zshrc

plugins=( 
    # other plugins...
    zsh-autosuggestions
)

配置生效

source .zshrc

安装命令高亮插件

github

MacOS

brew install zsh-syntax-highlighting

修改配置.zshrc

source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

配置生效

source .zshrc

Ubuntu

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

修改配置.zshrc

plugins=( [plugins...] zsh-syntax-highlighting)

配置生效

source .zshrc