使用说明
笔记本电脑设置
新工作笔记本电脑中需要设置的内容
设置流程
1.应用
下载
| 应用程序 | 目的 |
|---|---|
| 方便的 | 本地语音转文本 |
| ChatGPT | AI助手 |
| Brave浏览器 | Web浏览器 |
| Visual Studio代码 | 代码编辑器 |
通过 Homebrew 安装
安装Homebrew(如果尚未安装)
brew --version || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
包含的应用程序
| 工具 | 目的 |
|---|---|
| iTerm2 | 现代终端仿真器 |
| Maccy | 剪贴板历史管理器 |
| IINA | 现代视频播放器 |
| Postman | API开发和测试 |
全部安装
brew install --cask iterm2 maccy iina postman
2.终端设置
安装Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装Shell工具
brew install fzf zoxide
git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
$(brew --prefix)/opt/fzf/install
答案 y 所有提示。
更新 ~/.zshrc
将插件部分替换为
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
附加自定义配置
cat <<'EOF' >> ~/.zshrc
# =========================
# My Custom Configuration
# =========================
autoload -U colors && colors
PS1='%S%F{green}%n:%F{cyan}%~%F{yellow}%#%f%s'
alias dc="git commit --allow-empty -m 'test: dummy commit' && git push"
alias nst="npm start"
alias ns="npm run serve"
alias nt="npm run test"
alias gpm='git pull origin "$(git symbolic-ref --short refs/remotes/origin/HEAD | cut -d/ -f2)"'
alias gp="git push origin HEAD"
eval "$(zoxide init zsh)"
# =============================
# End of My Custom Configuration
# =============================
EOF
source ~/.zshrc && open ~/.zshrc
配置单词导航的选项键
配置选项键,以便使用快捷键,例如 ⌥+删除 删除前面的单词。
-
打开 iTerm2.
-
按 ⌘ + , 打开设置。
-
首选 档案→ Keys.
-
设置:
设置 值 左侧选项键 Esc+右选项键 Esc+
禁用退出确认
- 打开 iTerm2.
- 按 ⌘ + , 打开设置。
- 首选 通用→ 关闭.
- 不勾选 确认退出iTerm2.
3.GitHub CLI设置
安装GitHub CLI
brew install gh
验证
gh auth login
启用外壳完成
将以下行附加到中的现有自定义配置 ~/.zshrc:
eval "$(gh completion -s zsh)"
重新加载shell:
source ~/.zshrc
验证身份验证
gh auth status
4.VS代码设置
同步设置
- 打开 Visual Studio代码.
- 点击 设置同步 左下角的图标,或转到 设置→ 打开设置同步.
- 使用您的账号登录 个人GitHub帐户.
- 同步所有内容:设置、扩展、键盘快捷键、代码段、UI状态等。
启用 code 终端命令
-
打开 Visual Studio代码.
-
按 ⌘ + ⇧ + P.
-
运行:
Shell Command: Install 'code' command in PATH
5.浏览器设置
安装扩展(工作配置文件)
| 扩展 | 目的 |
|---|---|
| 书签搜索 | 快速搜索浏览器书签 |
| ColorZilla | 颜色选择器和CSS检查 |
| 黑暗阅读器 | 网站暗模式 |
| GoFullPage | 捕获整页截图 |
| 莫库 | 模拟网络请求 |
| OCR图像阅读器 | 从图像中提取文本 |
| 打开Jira门票 | 直接从票ID打开Jira票 |
| 页面规则器 | 测量网页上的距离和元素大小 |
| React开发工具 | 检查React组件树 |
| Redux工具 | 检查Redux状态和操作 |
6.macOS首选项
默认情况下将屏幕截图复制到剪贴板
- 按 ⌘ + ⇧ + 5.
- 点击 选项.
- 下 保存到,选择 剪贴板.
7.克劳德代码设置
配置状态行
复制以下提示并将其交给Claude Code:
Set up a Claude Code status line. Do not ask any questions; apply everything directly.
Create the directory if it does not exist, then create `~/.claude/statusline-command.sh` with the following exact content:
#!/bin/bash
# Format: ● {repo} ⎇ {branch} │ ▓░░░░░░░░░ 14% │ $0.05
# Plain monochrome text, no ANSI colors.
input=$(cat)
cwd=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // empty')
# Repo name: use git root name if in a repo, else current dir name
toplevel=$(git -C "$cwd" --no-optional-locks rev-parse --show-toplevel 2>/dev/null)
if [ -n "$toplevel" ]; then
repo_name=$(basename "$toplevel")
else
repo_name=$(basename "$cwd")
fi
# Branch name
branch=""
if [ -n "$cwd" ]; then
branch=$(git -C "$cwd" --no-optional-locks branch --show-current 2>/dev/null)
fi
[ -z "$branch" ] && branch="no-branch"
# Context window: 10-block progress bar + percentage
used_pct=$(echo "$input" | jq -r '.context_window.used_percentage // 0')
pct_int=$(printf "%.0f" "$used_pct")
filled=$(( (pct_int + 5) / 10 ))
[ "$filled" -gt 10 ] && filled=10
[ "$filled" -lt 0 ] && filled=0
empty=$((10 - filled))
bar=""
for ((i = 0; i < filled; i++)); do bar="${bar}▓"; done
for ((i = 0; i < empty; i++)); do bar="${bar}░"; done
# Session cost
cost=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
cost_str=$(printf "\$%.2f" "$cost")
printf "● %s ⎇ %s │ %s %s%% │ %s" "$repo_name" "$branch" "$bar" "$pct_int" "$cost_str"
Then create `~/.claude/settings.json` if it does not exist. Otherwise, preserve all of its existing settings and add or replace this top-level `statusLine` object:
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline-command.sh"
}
Ensure that `~/.claude/settings.json` remains valid JSON. Do not modify anything else.
安装MCPFlip
curl -fsSL https://raw.githubusercontent.com/prashant-DS/mcpflip/main/install-remote.sh | bash
配置终端焦点挂钩
复制以下提示并将其交给Claude Code:
Add two hooks to `~/.claude/settings.json` as global user settings, not project settings. Do not ask any questions; apply everything directly.
Read the existing file first. Preserve all existing top-level keys, including any existing `statusLine` configuration. Add or replace the top-level `hooks` object with the following valid JSON:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "for app in \"iTerm2\" \"iTerm\" \"Terminal\" \"Warp\" \"Ghostty\" \"Alacritty\" \"kitty\"; do if pgrep -ix \"$app\" > /dev/null 2>&1; then osascript -e \"tell application \\\"$app\\\" to activate\" 2>/dev/null && break; fi; done",
"async": true
}
]
}
],
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "for app in \"iTerm2\" \"iTerm\" \"Terminal\" \"Warp\" \"Ghostty\" \"Alacritty\" \"kitty\"; do if pgrep -ix \"$app\" > /dev/null 2>&1; then osascript -e \"tell application \\\"$app\\\" to activate\" 2>/dev/null && break; fi; done",
"async": true
}
]
}
]
}
}
After writing, validate the configuration with:
jq -e '.hooks.Stop[0].hooks[0].command, .hooks.Notification[0].hooks[0].command' ~/.claude/settings.json
Do not modify anything else.