Skip to content

Instantly share code, notes, and snippets.

@tomjamescn
Created February 28, 2020 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjamescn/ccdcda091650ff1d34b496e4eeba123f to your computer and use it in GitHub Desktop.
Save tomjamescn/ccdcda091650ff1d34b496e4eeba123f to your computer and use it in GitHub Desktop.
custom oh-my-zsh
#!/bin/bash
if [[ -z "$ZSH" ]]; then
echo "还未安装oh-my-zsh!"
exit 1
fi
os=`uname`
cp "$ZSH/themes/robbyrussell.zsh-theme" "$ZSH/custom/themes/robbyrussell.zsh-theme"
if [ "$os" == "Darwin" ]; then
# mac os x的sed命令-i选项与Linux的不太一样
sed -i '.bak' 's/^PROMPT.*$//' $ZSH/custom/themes/robbyrussell.zsh-theme 1>/dev/null
elif [ "$os" == "Linux" ]; then
sed -i 's/^PROMPT.*$//' $ZSH/custom/themes/robbyrussell.zsh-theme 1>/dev/null
else
echo "NOT SUPPORT OS:${os}"
exit 1
fi
echo "" >> $ZSH/custom/themes/robbyrussell.zsh-theme
(cat <<EOF
PROMPT='%{\$fg_bold[white]%}%M %{\$fg_bold[red]%}➜ %{\$fg_bold[green]%}%p %{\$fg[cyan]%}%c %{\$fg_bold[blue]%}\$(git_prompt_info)%{\$fg_bold[blue]%} % %{\$reset_color%}'
#PROMPT='%(!.%{%F{yellow}%}.)\$USER @ %{\$fg[white]%}%M %{\$fg_bold[red]%}➜ %{\$fg_bold[green]%}%p %{\$fg[cyan]%}%c %{\$fg_bold[blue]%}\$(git_prompt_info)%{\$fg_bold[blue]%} % %{\$reset_color%}'
EOF
) >> $ZSH/custom/themes/robbyrussell.zsh-theme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment