# .zshrc
source ~/.bash_profile
# Disable brew auto update
export HOMEBREW_NO_AUTO_UPDATE=1
## system
alias showFiles="defaults write com.apple.finder AppleShowAllFiles YES && killall Finder"
alias hideFiles="defaults write com.apple.finder AppleShowAllFiles NO && killall Finder"
# cd
alias ..='cd ../'
alias ...='cd ../../'
alias ..l.='cd ../../ && ll'
alias ....='cd ../../../'
alias ~="cd ~"
alias -- -="cd -"
alias c='clear'
alias ll='ls -alhG'
alias ls='ls -aG'
alias grep='grep --color=auto'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ps='ps aux'
alias df='df -h'
alias du='du -h'
alias history='history | more'
alias chmod='chmod -v'
alias chown='chown --verbose'
alias mkdir='mkdir -p'
# 设置终端主题
export CLICOLOR=1
# 设置 ls 命令输出颜色
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
# 设置终端背景颜色
export TERM_BACKGROUND="16;#f0f0f0"
# 设置光标颜色
export TERM_CURSOR="1;36"
# 设置目录颜色
export DIRCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
# 设置命令提示符颜色
autoload -U colors && colors
# 设置成功和失败的命令提示符颜色
PROMPT_SUCCESS="%F{green}"
PROMPT_FAILURE="%F{red}"
# 检查 Dark Mode 状态
is_dark_mode() {
if [ "$(defaults read -g AppleInterfaceStyle 2>/dev/null)" = "Dark" ]; then
return 0 # Dark Mode enabled
else
return 1 # Dark Mode disabled
fi
}
if is_dark_mode; then
color_prompt="%F{cyan}%n%f@%F{green}%m%f:%F{blue}%~%f"
else
color_prompt="%F{black}%n%f@%F{blue}%m%f:%F{red}%~%f"
fi
# 定义命令提示符
set_prompt() {
if [ $? -eq 0 ]; then
PS1="$color_prompt %%%F{reset} $PROMPT_SUCCESS"
else
PS1="$color_prompt %%%F{reset} $PROMPT_FAILURE"
fi
# 集成 conda 环境提示符
if [ ! -z "$CONDA_PROMPT_MODIFIER" ]; then
PS1="${CONDA_PROMPT_MODIFIER}${PS1}"
fi
}
# 在每次显示命令提示符前调用 set_prompt
precmd_functions+=(set_prompt)
export PATH="$PATH:/Users/li/.local/bin"
08-06
1143
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-01
2622
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-21