终端配置
Alias
# Example aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias gcb='git checkout -b'
alias gcm='git commit -m'
alias gca='git commit --amend'
alias gcae='git commit --amend --no-edit'
alias gpv='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
alias gpvf='git push -f'.gitconfig
[user]
email = kepengcheng314@163.com
name = Perfecto
[push]
autoSetupRemote = true
[init]
defaultBranch = master
[core]
autocrlf = input
safecrlf = true~/.ssh/config
Host github.com
Hostname ssh.github.com
Port 443
User gitzshrc
# Kiro CLI pre block. Keep at the top of this file.
[[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh"
# ╔════════════════════════════════════════════════════════════════════════════╗
# ║ Zsh 配置文件 ║
# ╠════════════════════════════════════════════════════════════════════════════╣
# ║ 加载顺序: 环境变量 → Zsh选项 → Oh My Zsh → 工具 → 补全 → 集成 ║
# ╚════════════════════════════════════════════════════════════════════════════╝
# ─────────────────────────────────────────────────────────────────────────────
# 1. 环境变量
# ─────────────────────────────────────────────────────────────────────────────
typeset -U PATH # PATH 自动去重
# Go
export GOROOT=/opt/homebrew/Cellar/go/1.25.4/libexec
export GOPATH=$HOME/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
# ─────────────────────────────────────────────────────────────────────────────
# 2. Zsh 选项
# ─────────────────────────────────────────────────────────────────────────────
# 目录
setopt AUTO_CD AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_SILENT
# 补全
setopt COMPLETE_IN_WORD ALWAYS_TO_END
# 纠错
setopt CORRECT CORRECT_ALL
# 其他
setopt INTERACTIVE_COMMENTS
# ─────────────────────────────────────────────────────────────────────────────
# 3. 历史记录
# ─────────────────────────────────────────────────────────────────────────────
HISTFILE=~/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt EXTENDED_HISTORY # 记录时间戳
setopt HIST_EXPIRE_DUPS_FIRST # 优先删重复
setopt HIST_IGNORE_DUPS # 连续重复不记录
setopt HIST_IGNORE_ALL_DUPS # 删除旧重复
setopt HIST_IGNORE_SPACE # 空格开头不记录
setopt HIST_FIND_NO_DUPS # 搜索去重
setopt HIST_SAVE_NO_DUPS # 保存去重
setopt SHARE_HISTORY # 多终端共享
# ─────────────────────────────────────────────────────────────────────────────
# 4. Oh My Zsh
# ─────────────────────────────────────────────────────────────────────────────
export ZSH="$HOME/.oh-my-zsh"
ZSH_DISABLE_COMPFIX=true
DISABLE_AUTO_UPDATE=true
ZSH_THEME="half-life"
plugins=(git zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
# ─────────────────────────────────────────────────────────────────────────────
# 5. 别名
# ─────────────────────────────────────────────────────────────────────────────
# 文件
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Python
alias python='python3'
alias pip='pip3'
# Git (补充 oh-my-zsh 的 git 插件)
alias gcb='git checkout -b'
alias gcm='git commit -m'
alias gca='git commit --amend'
alias gcae='git commit --amend --no-edit'
alias gpv='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
alias gpvf='git push -f'
# 工具
alias claude='claude --dangerously-skip-permissions'
# ─────────────────────────────────────────────────────────────────────────────
# 6. 工具初始化
# ─────────────────────────────────────────────────────────────────────────────
# fnm (Fast Node Manager)
[[ -d "/opt/homebrew/opt/fnm/bin" ]] && eval "$(fnm env --use-on-cd)"
# ─────────────────────────────────────────────────────────────────────────────
# 7. 补全配置
# ─────────────────────────────────────────────────────────────────────────────
# Docker
[[ -d "$HOME/.docker/completions" ]] && fpath=($HOME/.docker/completions $fpath)
# compinit (每天编译一次)
autoload -Uz compinit
if [[ "$(date +'%j')" != "$(stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)" ]]; then
compinit
else
compinit -C
fi
rehash
# ─────────────────────────────────────────────────────────────────────────────
# 8. 第三方集成
# ─────────────────────────────────────────────────────────────────────────────
# iTerm2
[[ -e "${HOME}/.iterm2_shell_integration.zsh" ]] && \
source "${HOME}/.iterm2_shell_integration.zsh"
# uv/uvx
[[ -f "$HOME/.local/bin/env" ]] && . "$HOME/.local/bin/env"
# Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh"