# 包管理工具 alias p="pnpm" alias pnpx="pnpm dlx" alias d="bun run dev" alias s="bun run start" alias b="bun run build" alias t="bun run test" alias dp="bun run deploy"
# 代码检查 alias lint="nr lint" alias lintf="nr lint --fix"
# git 操作 alias glogp="git log --pretty='%C(yellow)%h%C(reset) %ad %C(green)%s%C(reset) %C(red)%d%C(reset) %C(bold blue)[%an]%C(reset)'" alias gcl1="git clone --depth=1" alias gpp="proxy && git push && unproxy" alias glp="proxy && git pull && unproxy" alias dmm="git checkout master && git pull && git merge develop"
# 工具别名 aliascat="bat" alias commit="czg"
终端代理开关:
同时设置大写和小写环境变量,兼容不同应用对代理变量的读取差异:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
functionproxy() { local http="http://127.0.0.1:7890" local socks5="socks5://127.0.0.1:7890"
if [[ -d .git ]]; then local githubName=""# GitHub 用户名 local githubEmail=""# GitHub 邮箱 local url=$(git remote get-url origin) local localName=$(git config user.name) local localEmail=$(git config user.email)
if [[ $url =~ "github.com/maomao1996" ]]; then echo -e "\033[34m当前为 GitHub 项目\033[0m" if [[ $githubName && $githubName != $localName ]]; then git config user.name "$githubName" echo -e "已将当前仓库的 name 从 \033[33m$localName\033[0m 修改为 \033[32m$githubName\033[0m" fi if [[ $githubEmail && $githubEmail != $localEmail ]]; then git config user.email "$githubEmail" echo -e "已将当前仓库的 email 从 \033[33m$localEmail\033[0m 修改为 \033[32m$githubEmail\033[0m" fi fi fi