Oh My Zsh

2022-11-23

安装

Terminal window
1
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2
3
# 写入 zshrc
4
echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc

主题

插件

自带

oh-my-zsh 自带的插件,无须安装,直接在 .zshrc 文件内添加插件名:

  • Git
  • sudo:命令前加 sudo(连按 ECS 两下)
  • z:目录快速跳转
  • vi-mode:命令行 vi 模式

第三方

安装方式:把下载到 $ZSH_CUSTOM/plugins/ 目录下,然后 source ~/.zshrc 即可:

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

Poetry

Poetry 之前有第三方插件:

darvid/zsh-poetry,现在可以直接通过 Poetry 安装:

Terminal window
1
mkdir $ZSH_CUSTOM/plugins/poetry
2
poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry

当然同样也要在 plugins 中增加 poetry。