This commit is contained in:
🐟 2023-09-11 12:45:23 +08:00
parent b7c998f014
commit b5ee457359
3 changed files with 18 additions and 48 deletions

View File

@ -6,6 +6,8 @@ install:
ohm: ./install-zsh.sh ohm:
chmod +x $(OS)
$(OS)
alias: chmod +x $(AS) && $(AS) alias: chmod +x $(AS) && $(AS)

10
install-oh-my-zsh.sh Normal file → Executable file
View File

@ -510,3 +510,13 @@ EOF
echo "${FMT_YELLOW}Run zsh to try it out.${FMT_RESET}" echo "${FMT_YELLOW}Run zsh to try it out.${FMT_RESET}"
exit exit
fi fi
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
cp ~/.zshrc ~/.zshrc.ohm.bak
awk '{gsub(/ZSH_THEME="robbyrussell"/, "ZSH_THEME=\"powerlevel10k/powerlevel10k\""); print}' ~/.zshrc > temp && mv temp ~/.zshrc
echo 'auto apply $ZSH_THEME="powerlevel10k/powerlevel10k"'
exec zsh -l
}
main "$@"

View File

@ -512,53 +512,11 @@ EOF
fi fi
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# sed -i 's/ZSH_THEME=\"robbyrussell\"/ZSH_THEME=\"powerlevel10k\/powerlevel10k\"/g' ~/.zshrc
sed -i 's/ZSH_THEME=\"robbyrussell\"/ZSH_THEME=\"powerlevel10k\/powerlevel10k\"/g' ~/.zshrc cp ~/.zshrc ~/.zshrc.ohm.bak
awk '{gsub(/ZSH_THEME="robbyrussell"/, "ZSH_THEME=\"powerlevel10k/powerlevel10k\""); print}' ~/.zshrc > temp && mv temp ~/.zshrc
echo 'apply $ZSH_THEME="powerlevel10k/powerlevel10k"' echo 'apply $ZSH_THEME="powerlevel10k/powerlevel10k"'
zsh
if [ ! -f "~/.alias.d" ];then
echo "将创建 ~/.alias.d 用于存放自定义快捷方式"
AHome="$HOME/.alias.d"
mkdir "$AHome"
init_sell="$AHome/.init"
echo "" > "$init_shell"
echo '# set PATH so it includes user`s private bin if it exists' >> "$init_shell"
echo 'if [ -d "$HOME/bin" ] ; then' >> "$init_shell"
echo ' PATH="$HOME/bin:$PATH"' >> "$init_shell"
echo 'fi' >> "$init_shell"
echo '' >> "$init_shell"
echo '# set PATH so it includes user`s private bin if it exists' >> "$init_shell"
echo 'if [ -d "$HOME/.local/bin" ] ; then' >> "$init_shell"
echo ' PATH="$HOME/.local/bin:$PATH"' >> "$init_shell"
echo 'fi' >> "$init_shell"
echo '' >> "$init_shell"
echo '# set PATH so it includes user`s private bin if it exists' >> "$init_shell"
echo 'if [ -d "$HOME/go/bin" ] ; then' >> "$init_shell"
echo ' PATH="$HOME/go/bin:$PATH"' >> "$init_shell"
echo 'fi' >> "$init_shell"
echo "setopt no_nomatch" >> "$init_shell"
echo '# 遍历' >> "$init_shell"
echo '# for item in `ls ~/.alias.d/*.sh`; do' >> "$init_shell"
echo '# source $item' >> "$init_shell"
echo '# done' >> "$init_shell"
echo 'export AHome="$HOME"/.alias.d' >> "$init_shell"
echo 'for ali in "$AHome"/*.sh' >> "$init_shell"
echo 'do' >> "$init_shell"
echo ' [[ -e "$ali" ]] || break # 无 alias 停止' >> "$init_shell"
echo ' source "$ali"' >> "$init_shell"
echo 'done' >> "$init_shell"
echo "#common config" >> "$init_shell"
echo "alias va='vim ~/.alias.d'" >> "$init_shell"
echo "alias vz='vim ~/.zshrc'" >> "$init_shell"
echo "alias rez='source ~/.zshrc'" >> "$init_shell"
else
echo ".alias 已存在,将不做改动"
fi
echo "source "$init_shell"" >> ~/.zshrc
exec zsh -l
} }
main "$@" main "$@"