252 字
1 分钟
Linux 下安装 oh-my-zsh
安装 Zsh
apt update -y && apt install zsh -y安装 oh-my-zsh
- 使用 curl 下载安装
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"- 使用 wget 下载安装
sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"Oh My Zsh 安装完成后会提示你设置 zsh 为默认 sehll 。如果没有提示,输入下面的命令进行设置:
chsh -s $(which zsh)修改 oh-my-zsh 配置
修改主题
如果你不知道选择什么,可以试试在 主题排名 中看下
sed -i '/^ZSH_THEME=/c\ZSH_THEME="ys"' ~/.zshrcsource ~/.zshrc安装插件
代码高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting自动建议
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions自动补全
git clone https://github.com/zsh-users/zsh-completions $ZSH_CUSTOM/plugins/zsh-completions# 另外还需要配置[ -z "`grep "autoload -U compinit && compinit" ~/.zshrc`" ] && echo "autoload -U compinit && compinit" >> ~/.zshrc将插件写入配置中
sed -i '/^plugins=/c\plugins=(git sudo z zsh-syntax-highlighting zsh-autosuggestions zsh-completions)' ~/.zshrc性能优化
zsh-defer 延迟加载
git clone https://github.com/romkatv/zsh-defer.git ~/zsh-defer在 ~/.zshrc 顶部添加下面命令
source ~/zsh-defer/zsh-defer.plugin.zsh# 记得替换为自己的路径zsh-defer source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zshzsh-defer source $ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh