oh-my-zsh配置(自用)

  • 2019-11-27
  • 1,804
  • 0
  • 0
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/g' ~/.zshrc
sed -i 's/#DISABLE_AUTO_UPDATE="true"/DISABLE_AUTO_UPDATE="true"/g' ~/.zshrc
cat >> ~/.zshrc << "EOF"
alias py="python3"
alias py2="python2"
alias du1="du -h --max-depth=1"
alias du2="du -h --max-depth=2"
# 关闭 "多session共享历史记录"
unsetopt share_history
# 关闭 "zsh通配符匹配"
setopt no_nomatch
#source /mnt/lustre/share/platform/env/pat0.4.0b0 #ST集群用

# 以下两行wsl不需要,仅Linux用
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
EOF

git config --global oh-my-zsh.hide-status 1
sed -i 's/    prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"/#    prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"/g' $ZSH/themes/agnoster.zsh-theme
# 在root用户下不显示专属标记(⚡)
sed -i 's/  [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"/#  [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"/g' $ZSH/themes/agnoster.zsh-theme

root用户的另一种标记方式:

在$ZSH/themes/agnoster.zsh-theme文件大概201行,prompt_dir()函数中,添加:

[ $SUDO_UID ] && prompt_segment blue $CURRENT_FG '%{%F{red}%}[Root]'

评论

还没有任何评论,你来说两句吧

发表评论

冀ICP备19026961号