文章目录
- 1. 安装指南
- 2. 插件配置指南
- 3. 参考信息
1. 安装指南
1. 安装 zsh
sudo apt install zsh
2. 安装 Oh My Zsh
- 国内访问GitHub
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
这将安装 Oh My Zsh 和所有默认插件。
- 使用清华镜像 清华镜像
# install
git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git
cd ohmyzsh/tools
REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh install.sh
# change source
git -C $ZSH remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git
git -C $ZSH pull
3. 设置 zsh 为默认 shell
chsh -s $(which zsh)
2. 插件配置指南
所有的插件都应该下载到 ~/.oh-my-zsh/custom/plugins
推荐 GitHub 的开源项目: awesome-zsh-plugins, 可以找到所有目前主流程序猿使用的插件列表。
- auto suggestions
非常好用的一个插件,会记录你之前输入过的所有命令,并且自动匹配你可能想要输入命令,然后按→补全
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- zsh-syntax-highlighting
命令太多,有时候记不住,等输入完了才知道命令输错了,这个插件直接在输入过程中就会提示你,当前命令是否正确,错误红色,正确绿色
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- auto-jump
git clone https://github.com/wting/autojump.git
之后执行./install.py
文件,即可安装成功
3. 参考信息
ohmyzsh的GitHub主页地址
插件安装指南
- 备份目前我使用的所有插件:
plugins=(
git
pip
ag
poetry
zsh-autosuggestions
z # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/z
zsh-syntax-highlighting # https://github.com/zsh-users/zsh-syntax-highlighting
autojump
copypath # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copypath
copyfile # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copyfile
zsh-history-substring-search # https://github.com/zsh-users/zsh-history-substring-search
you-should-use # https://github.com/MichaelAquilina/zsh-you-should-use#installation
)