[!NOTE] This is a collection of configurations that includes all on my Mac.
keywords: [git, homebrew, nerdfonts, fish, starship, neovim, tmux, golang, rust]
新mac: 无任何配置
git clone https://github.com/dev24hrs/Dotfiles.git ~/Documents/Dotfiles
cd ~/Documents/Dotfiles && chmod +x setup.sh && ./setup.sh
# setup.sh 脚本会执行dotfiles的所有配置相关使用场景:
- 脚本里维护数据集
# 单一数据源,格式: <dotfiles 内的相对路径>:<目标绝对路径>
# setup_symlinks 和 migrate_to_dotfiles 都基于这个清单工作
DOTFILES_DIR="$HOME/Documents/Dotfiles"
CONFIG_MAP=(
"tmux:$HOME/.config/tmux"
"fish:$HOME/.config/fish"
"nvim:$HOME/.config/nvim"
"git/.gitconfig:$HOME/.gitconfig"
"git/.gitignore_global:$HOME/.gitignore_global"
"ghostty:$HOME/.config/ghostty"
"bat:$HOME/.config/bat"
"starship:$HOME/.config/starship"
"lazygit:$HOME/.config/lazygit"
"wezterm:$HOME/.config/wezterm"
"yazi:$HOME/.config/yazi"
"go-musicfox:$HOME/.config/go-musicfox"
)./cfg.sh symlinks: 当前mac环境,之前手动维护~/.config&dotfiles,现在改成symlink方式
# 在Dotfiles目录执行 ./cfg.sh symlinks
# 自动在 ~/.config目录下创建相关链接,并链接到Dotfiles的对应配置目录/文件
# 同时备份之前手动管理的配置./cfg.sh add: 假如后续想安装某个/某些软件,在Dotfiles目录下配置之后
# 比如新安装了yazi,则在Dotfiles目录下执行
# 短路径
./cfg.sh add yazi
# 或者绝对路径
./cfg.sh add ~/Dotfiles/yazi
# 然后手动在 cfg.sh 的 setup_symlinks() 里补上对应的 make_link
# 最后 git 提交Dotfiles更新- 同步到 Brewfile 文件
brew bundle dump --file=~/Dotfiles/Brewfile --force --no-vscode
# --force 表示已存在则覆盖
# --no-vscode 表示跳过vscode相关- 在新 mac 上安装 Brewfile 里的所有包
brew bundle install --file=~/Dotfiles/Brewfile- 检查哪些包已安装、哪些还没装
brew bundle check --file=~/Dotfiles/Brewfile- 清理本机有但 Brewfile 里没有的包(同步删除)
brew bundle cleanup --file=~/Dotfiles/Brewfile
# 加 --force 才会真正删除,不加只是预览
brew bundle cleanup --file=~/Dotfiles/Brewfile --forceNote
已存在于 setup.sh 自动配置
# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1 # default 2,recommend 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
# mac app id
osascript -e 'id of app "app name"'
# e.g
osascript -e 'id of app "Wezterm"'refer to git config
Use pkg to install homebrew, but need to config config.fish
# add to config.fish
# homebrew
eval (/opt/homebrew/bin/brew shellenv)
# set ustc mirrors
# export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
# export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
# export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
# then
source ~/.config/fish/config.fish
brew update
# if unistall
# then brew autoremove
# brew cleanup
# brew cleanup --prune=all-
english: recursive & fira
brew install --cask font-recursive-mono-nerd-font brew install --cask font-fira-mono-nerd-font
-
symbols
brew install --cask font-symbols-only-nerd-font
-
chinese simple : source-han-sans
brew install --cask font-source-han-sans-vf
Note
The brew method installs many unnecessary fonts. For example, when installing Source Han Sans, brew will automatically install Japanese, Korean, and Traditional Chinese fonts, but I only need Simplified Chinese.
-
english
## recursive & fira https://www.nerdfonts.com/font-downloads -
chinese simple
## chinese simple otf https://github.com/adobe-fonts/source-han-sans/releases
refer to fish config
refer to starship config
- install starship
brew install starship- with fish
starship init fish | source
# config
# use preset & restart terminal starship preset nerd-font-symbols -o ~/.config/starship/starship.toml
# or can refer to github dotfiles- install bat
brew install bat- config
# config
bat --generate-config-file
# add to ~/.config/bat/config
--paging=never
--theme="gruvbox-dark"
--style="numbers,changes,header,snip,rule"- with fish
# add to config.fish
alias cat='bat'- install fzf
brew install fzf- with fish
# add to config.fish
# FZF
fzf --fish | source
set -gx FZF_DEFAULT_COMMAND 'fd --type f --strip-cwd-prefix --hidden --follow --exclude .git'
set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND"
set -gx FZF_DEFAULT_OPTS "--height 40% --layout=reverse --border --preview 'bat --style=numbers --color=always --line-range :500 {}' --preview-window 'right,60%,border-left'"
set -gx FZF_CTRL_R_OPTS "--preview-window hidden"- install zoxide
brew install zoxide- with fish
zoxide init fish | source-
install eza
brew install eza
-
with fish
alias ls='eza -a --icons --group-directories-first' alias la='eza -la --icons --group-directories-first' alias lt='eza -aT --icons --group-directories-first --git-ignore'
brew install fd
brew install ripgreprefer to config or default config
- install lazygit
brew install lazygit- with fish
alias lg='lazygit'- install cheat.sh
# add to config.fish
function ch --description 'curl cheat.sh'
curl cheat.sh/$argv[1]
end
# use
ch go chan- install go-musicfox
brew install anhoder/go-musicfox/go-musicfox- with fish
alias mu='musicfox'refer to wezterm config
- install wezterm
brew install --cask wezterm@nightlyconfig refer to tmux dotfiles
config refer to nvim dotfiles
Refer to vimrc
Refer to rime 输入法
Mole 是一个开源的 macOS CLI 工具箱,集成了 CleanMyMac + AppCleaner + DaisyDisk + iStat Menus 的核心功能。
brew install molemo status # 实时系统仪表盘 — CPU/内存/磁盘/网络/电池健康
mo status --json # JSON 输出,可管道给 jq
mo analyze # 交互式磁盘空间分析(方向键/Vim键浏览)
mo analyze /Volumes # 分析外接磁盘
mo history # 查看历史操作日志mo clean --dry-run # 预览垃圾清理
mo uninstall --dry-run # 预览卸载结果
mo purge --dry-run # 预览构建产物清理
mo installer --dry-run # 预览安装包清理
mo optimize --dry-run # 预览系统优化操作mo clean --whitelist # 交互式配置清理白名单
mo optimize --whitelist # 交互式配置优化白名单配置文件:~/.config/mole/whitelist,支持 glob 模式。
mo clean # 深度垃圾清理(缓存/日志/浏览器/Temp)
mo uninstall # 智能卸载 + 12+ 路径残留扫描
mo optimize # 系统优化(重建缓存/刷新DNS/修复Spotlight)
mo purge # 清理 node_modules/target/dist 等构建产物
mo installer # 清理残留 .dmg/.pkg 安装包
mo touchid # 配置 Touch ID for sudo
mo completion # 安装 shell 自动补全
mo update # 更新 Mole
mo remove # 卸载 Mole# 每周日常维护
mo clean
# 卸载应用后清残留
mo uninstall
# 磁盘不够 — 先分析再清理
mo analyze
mo installer
# 系统卡顿 — 一键优化
mo optimize
# 开发者 — 清构建产物(7天内修改的项目自动跳过)
mo purge- install
# brew install
brew install go
go version
brew upgrade go
# set env
mkdir -p $HOME/Documents/Tools/GoPath/pkg
mkdir -p $HOME/Documents/Tools/GoPath/bin
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=on
go env -w GOPATH=$HOME/Documents/Tools/GoPath
# gofumpt
go install mvdan.cc/gofumpt@latest
# gopls
go install golang.org/x/tools/gopls@latest- with fish
set -gx GOPATH $HOME/Documents/Tools/GoPath
fish_add_path $GOPATH/bin- Go 语言圣经 https://golang-china.github.io/gopl-zh/index.html
- Go 语言设计与实现 https://draveness.me/golang/
- Go 语言高级编程 https://chai2010.cn/advanced-go-programming-book/index.html
Refer to set up
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh其他命令:
rustc --version
cargo --version
rustup update-
官方文档中文 https://rustwiki.org/
-
Rust 程序设计语言 https://rustwiki.org/zh-CN/book/
-
Rust 程序设计语言 https://doc.rust-lang.org/book/ch01-01-installation.html
-
Rust Cookbook 中文版 https://rustwiki.org/zh-CN/rust-cookbook/
-
awesome rust https://github.com/rust-unofficial/awesome-rust
-
Rust 嵌入式 https://github.com/rust-embedded/awesome-embedded-rust
-
AlDente -- charge limiter app
-
lemon -- mac clean app
-
Chrome -- browser
-
appcleaner -- app manager
-
snipaster -- screenshot
-
vlc -- video player
-
Vimium -- Chrome & Arc extension for Vim
# config Custom key unmap / map <c-/> enterFindMode # Custom search engines # so u can press o and enter g/bd/gh to search something bd: http://www.baidu.com/s?wd=%s+-csdn Baidu g: https://www.google.com/search?q=%s Google gh: https://github.com/search?q=%s GitHub
-
sublime text -- buy license from taobao
{ "ignored_packages": [ "Vintage", ], "color_scheme": "ayu-light.sublime-color-scheme", "theme": "ayu-light.sublime-theme", "always_prompt_for_file_reload": true, "font_size": 16, "remember_open_files": true, "update_check": false, "font_face": "RecMonoCasual Nerd Font", } -
PicGo -- upload images to GitHub
if u forget your GitHub tokens, u cant find it in the blew file
data.json// the data.json saved all the uploaded imgs info // this is vscode settings "picgo.dataPath": "$home/Library/Application Support/picgo/data.json",
If use typora & picgo app, when u pasted images in typora,it will cached images in the path
$home/Library/Application\ Support/typora-user-images,so u need clean it.
This project is licensed under the MIT License.
