安装 zsh
Ubuntu 安装 zsh
sudo apt update
sudo apt install zsh
CentOS8 安装 zsh
dnf install -y zsh
验证是否安装成功
zsh --version
下载oh-my-zsh
安装脚本
如果访问 GitHub 没有问题的话,建议使用脚本安装。
脚本安装
官方网站:https://ohmyz.sh/#install
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
或者
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
或者
sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Git安装(使用加速通道)
克隆 ohmyzsh 仓库
git clone https://github.91chi.fun/https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
创建 zsh 配置文件
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
修改 shell 默认使用 zsh
chsh -s $(which zsh)
重新打开终端,应该会加载带有 oh-my-zsh
配置的 zsh
。
修改主题
内置主题目录 ~/.oh-my-zsh/themes
,编辑 ~/.zshrc
修改 ZSH_THEME
为自己喜欢的主题名称,我个人很喜欢 ys
。
内置主题预览:https://github.com/ohmyzsh/ohmyzsh/wiki/Theme
外部主题预览:https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes
vim ~/.zshrc
# 个人喜欢的主题
ZSH_THEME="ys"
修改插件
内置插件目录~/.oh-my-zsh/plugins
,编辑 ~/.zshrc
中的 plugins=()
默认只启用了 git
。
内置插件:https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
外部插件:https://github.com/ohmyzsh/ohmyzsh/wiki/External-plugins
安装插件
以下
GitHub
地址都使用了加速通道
自动补全插件
git clone https://github.91chi.fun/https://github.com/zsh-users/zsh-completions.git ~/.oh-my-zsh/custom/plugins/zsh-completions
自动提示插件
git clone https://github.91chi.fun/https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
语法高亮插件
git clone https://github.91chi.fun/https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Laravel artisan 插件
到
Laravel
项目目录下,可执行artisan
命令,按tab
键可提示
git clone https://github.91chi.fun/https://github.com/jessarcher/zsh-artisan.git ~/.oh-my-zsh/custom/plugins/artisan
修改 ~/.zshrc
vim ~/.zshrc
最终的 plugins
如下
plugins=(
git
artisan
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
)
zsh:no matches found 问题的解决方法
在 ~/.zshrc
中加入以下内容
setopt no_nomatch