oh my zsh
修改默认 shell
用如下命令检查或修改当前 shell(MacOS 默认就是 zsh):
1 | |
下载安装 ohmyzsh
GitHub:https://github.com/ohmyzsh/ohmyzsh
1 | |
编辑 zsh 配置文件
1 | |
个人常用配置在 https://github.com/xyfJASON/rc/blob/main/.zshrc 中维护。
使配置生效:
1 | |
主题
自带主题
ohmyzsh 自带很多主题,可以在 ~/.oh-my-zsh/themes 下查看。
要更换主题,直接修改 ~/.zshrc 中 ZSH_THEME 字段即可,例如:
1 | |
powerlevel10k
GitHub: https://github.com/romkatv/powerlevel10k
下载安装:
1 | |
设置主题:修改 ~/.zshrc 中 ZSH_THEME 字段。
1 | |
第一次启动后会自动运行设置引导,输入 p10k configure 手动运行设置引导。
插件
z (ohmyzsh 自带)
文档:https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/z
介绍:ohmyzsh 自带插件,快速跳转到访问过的目录。
添加 plugins:在 ~/.zshrc 中将 z 添加到 plugins 字段中。
1 | |
colored-man-pages (ohmyzsh 自带)
文档:https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/z
介绍:ohmyzsh 自带插件,给 man pages 加上颜色。
添加 plugins:在 ~/.zshrc 中将 colored-man-pages 添加到 plugins 字段中。
1 | |
safe-paste (ohmyzsh 自带)
文档:https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/z
介绍:ohmyzsh 自带插件,避免粘贴命令后立刻执行。
添加 plugins:在 ~/.zshrc 中将 safe-paste 添加到 plugins 字段中。
1 | |
sublime (ohmyzsh 自带)
文档:https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sublime
介绍:ohmyzsh 自带插件,使用 Sublime Text 打开文件。
添加 plugins:在 ~/.zshrc 中将 sublime 添加到 plugins 字段中。
1 | |
使用方法:
st:打开 Sublime Text.st <file/directory>:使用 Sublime Text 打开文件或目录。stt:使用 Sublime Text 打开当前目录。
conda-zsh-completion
GitHub: https://github.com/conda-incubator/conda-zsh-completion
下载安装:
1 | |
添加 plugins:在 ~/.zshrc 中将 conda-zsh-completion 添加到 plugins 字段中。
1 | |
zsh-autosuggestions
GitHub: https://github.com/zsh-users/zsh-autosuggestions
下载安装:
1 | |
添加 plugins:在 ~/.zshrc 中将 zsh-autosuggestions 添加到 plugins 字段中。
1 | |
zsh-syntax-highlighting
GitHub: https://github.com/zsh-users/zsh-syntax-highlighting
下载安装:
1 | |
添加 plugins:在 ~/.zshrc 中将 zsh-syntax-highlighting 添加到 plugins 字段中。
1 | |
zsh-history-substring-search
GitHub: https://github.com/zsh-users/zsh-history-substring-search
下载安装:
1 | |
添加 plugins:在 ~/.zshrc 中将 zsh-syntax-highlighting 添加到 plugins 字段中,注意放在最后一个。
1 | |
按键绑定:
1 | |