Feb-27, 2025 · 10min
确保有良好的网络环境
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
这里安装完成后会需要执行几个命令设置环境变量,由对应的提示
克隆仓库
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
复制模板文件
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
重新加载配置
source ~/.zshrc
克隆仓库
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
在 .zshrc
中添加
ZSH_THEME="powerlevel10k/powerlevel10k"
重新加载配置
source ~/.zshrc
安装支持图标的字体文件
终端设置使用字体
自定义配置
p10k configure
配置显示的数据
配置显示 node 版本号和 package.json 版本
vim ~/.p10k.zsh
安装 zsh 插件
zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
在 .zshrc
中添加
plugins=(
git
sudo
z
zsh-autosuggestions
zsh-syntax-highlighting
)
完整文件 .zshrc, 文件名是 .zshrc
生成 ssh 密钥
ssh-keygen -m PEM -t ed25519 -C "your.email@example.com"
查看 ssh 公钥
cat ~/.ssh/id_ed25519.pub
全局用户名邮箱
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
当前仓库用户名邮箱
git config --local user.name "Your Name"
git config --local user.email "email@example.com"
配置 quotepath
选项
避免中文路径乱码
git config --global core.quotepath false
不忽略大小写
git config --global core.ignorecase false
完整的配置 .gitconfig
[user]
name = "Your Name"
email = "email@example.com"
[core]
quotepath = false
ignorecase = false
生成多个 ssh 密钥
ssh-keygen -m PEM -t ed25519 -C "your.email@example.com" -f ~/.ssh/id_ed25519
ssh-keygen -m PEM -t ed25519 -C "your.email@example.com" -f ~/.ssh/id_ed25519_gitlab
配置 ssh 配置文件
vim ~/.ssh/config
完整的配置 .ssh/config
# Personal account, - the default config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
ProxyCommand nc -v -x 127.0.0.1:7890 %h %p
# Work account-1
Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/id_ed25519_gitlab
IdentityFile
为当前的 Host 配置 ssh 密钥
ProxyCommand
为 GitHub 仓库配置代理,使用 nc
命令,127.0.0.1:7890
是本机代理端口
仅在台前调度时,点击墙纸显示桌面
调整鼠标指针大小
关闭自动首字母大写
vim 设置键盘重复
全局打开键盘长按连续输入
defaults write -g ApplePressAndHoldEnabled -bool false