install_ohmyzsh.sh
· 1.5 KiB · Bash
Bruto
#!/bin/bash
yum install git zsh bash-completion wget unzip tree tmux vim sysstat -y -q &> /dev/null || true
# install oh-my-zsh
git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git
REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh ohmyzsh/tools/install.sh && rm -rf ohmyzsh
ZSH=$HOME/.oh-my-zsh
# install zsh-syntax-highlighting
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://mirrors.nju.edu.cn/git/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting
# echo "source $ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
# install zsh-autosuggestions
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://mirrors.nju.edu.cn/git/zsh-autosuggestions.git $ZSH/custom/plugins/zsh-autosuggestions
# echo "source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
# replace plugins and theme
cp $HOME/.zshrc $HOME/.zshrc.bak
zsh -c 'source ~/.zshrc && omz plugin enable zsh-autosuggestions zsh-syntax-highlighting sudo'
zsh -c 'source ~/.zshrc && omz theme set ys'
# sed -i 's/(git/(git zsh-syntax-highlighting zsh-autosuggestions sudo/g' ~/.zshrc
# sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="ys"/g' ~/.zshrc
cat >> ~/.zshrc <<UK
## add
zstyle ':omz:update' mode disabled
HIST_STAMPS="yyyy-mm-dd"
alias vi="vim"
UK
| 1 | #!/bin/bash |
| 2 | |
| 3 | yum install git zsh bash-completion wget unzip tree tmux vim sysstat -y -q &> /dev/null || true |
| 4 | |
| 5 | # install oh-my-zsh |
| 6 | git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git |
| 7 | REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh ohmyzsh/tools/install.sh && rm -rf ohmyzsh |
| 8 | |
| 9 | ZSH=$HOME/.oh-my-zsh |
| 10 | # install zsh-syntax-highlighting |
| 11 | # git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting |
| 12 | git clone https://mirrors.nju.edu.cn/git/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting |
| 13 | # echo "source $ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc |
| 14 | |
| 15 | # install zsh-autosuggestions |
| 16 | # git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions |
| 17 | git clone https://mirrors.nju.edu.cn/git/zsh-autosuggestions.git $ZSH/custom/plugins/zsh-autosuggestions |
| 18 | # echo "source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc |
| 19 | |
| 20 | # replace plugins and theme |
| 21 | cp $HOME/.zshrc $HOME/.zshrc.bak |
| 22 | zsh -c 'source ~/.zshrc && omz plugin enable zsh-autosuggestions zsh-syntax-highlighting sudo' |
| 23 | zsh -c 'source ~/.zshrc && omz theme set ys' |
| 24 | # sed -i 's/(git/(git zsh-syntax-highlighting zsh-autosuggestions sudo/g' ~/.zshrc |
| 25 | # sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="ys"/g' ~/.zshrc |
| 26 | |
| 27 | cat >> ~/.zshrc <<UK |
| 28 | |
| 29 | ## add |
| 30 | zstyle ':omz:update' mode disabled |
| 31 | HIST_STAMPS="yyyy-mm-dd" |
| 32 | alias vi="vim" |
| 33 | UK |