187 字
1 分钟
oh-my-zsh的安装与配置
为你的终端配置一个更好用的shell
安装前置
sudo apt install zsh git curl wget vim -y安装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)"安装插件
zsh-autosuggestions
自动补全插件,可以根据历史命令自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestionszsh-syntax-highlighting
语法高亮插件,当命令错误时会显示红色
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightingz
目录跳转插件,可以根据历史访问频率跳转到指定目录,oh-my-zsh自带
使用插件
打开配置文件
vim ~/.zshrc修改配置
找到plugins行,添加插件名
plugins=( ... # 其他插件 git zsh-autosuggestions zsh-syntax-highlighting z)修改主题
具体主题可以在这里查看
也可安装p10k主题
ZSH_THEME="random" # 随机主题使配置生效
source ~/.zshrc