在折腾过 antigen、antidote、sheldon 等 Zsh 的包管理器之后,我发现我主要使用的还是 oh-my-zsh。那就回归本源,再加上现在 oh-my-zsh 也可以自定义 Plugin。
1 2 3 4 5 6 7 8 9
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions git clone --depth=1 https://github.com/zsh-users/zsh-completions $ZSH_CUSTOM/plugins/zsh-completions git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
git clone --depth=1 https://github.com/spaceship-prompt/spaceship-prompt.git $ZSH_CUSTOM/themes/spaceship-prompt ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
|
在 .zshrc
中 通过 plugins
配置需要启用的插件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| export ZSH="$HOME/.oh-my-zsh" DISABLE_MAGIC_FUNCTIONS=true ZSH_THEME="spaceship" plugins=( command-not-found common-aliases docker git bun npm yarn kubectl asdf thefuck zsh-autosuggestions zsh-syntax-highlighting zsh-completions ) source $ZSH/oh-my-zsh.sh
|
1 2
| alias update-omz-plugins='[ -n "$ZSH_CUSTOM" ] && [ -d "$ZSH_CUSTOM" ] && find "$ZSH_CUSTOM" -type d -name ".git" -exec sh -c "cd \"{}\"/../ && echo Updating {} && git pull --rebase" \;'
|
---EOF---