oh-my-zsh 新安装

虚拟机重装,调整一下安装zsh的安装脚本,减少下次安装的工作量。

# 一次性安装脚本,便于抄写部分,不适合批量执行

# 安装zsh
sudo apt -y install zsh

# 各个用户安装
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# 调整主题和大小写敏感,并禁用自动更新
sed -i "s|ZSH_THEME="robbyrussell"|ZSH_THEME="risto"|" ~/.zshrc
sed -i "s|# CASE_SENSITIVE="true"|CASE_SENSITIVE="true"|" ~/.zshrc
sed -i "s|# DISABLE_AUTO_UPDATE="true"|DISABLE_AUTO_UPDATE="true"|" ~/.zshrc

# 让调整生效
exec zsh

# 安装插件
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions \
          ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git \
          ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

sed -i "s|plugins=(git)|plugins=(git zsh-autosuggestions zsh-syntax-highlighting)|" ~/.zshrc

# 定义定时更新脚本,每天12点更新
cron_job="0 12 * * * `which zsh` `realpath ./.oh-my-zsh/tools/upgrade.sh` >/dev/null 2>&1"
# 添加定时任务
(crontab -l | grep -v "$cron_job"; echo "$cron_job" ) | crontab -

# 手动更新
omz update

# 调整生效
exec zsh

注:关于zsh的home,end键失效的问题,别折腾了,用 ctrl+a, ctrl+e解决吧,唉!

当前还没有任何评论

写下你最简单的想法