mac 生产力配置指北
🖥️

mac 生产力配置指北

Created time
Aug 1, 2021 07:21 AM
Tags
生产力
productivity
blog
setup
mac
Priority
Status
Date
Aug 1, 2021
 

参考链接🔗

👇👇👇🌟🌟🌟
 

Homebrew

安装

# Install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

备份

brew bundle dump --describe --force --file="~/Documents/Brewfile"

恢复

brew bundle --file="~/Documents/Brewfile"
 
这里提供一份我的 Brewfile,作为参考:
Brewfile
tap "homebrew/bundle"
tap "homebrew/cask", "https://mirrors.ustc.edu.cn/homebrew-cask.git"
tap "homebrew/cask-fonts"
tap "homebrew/core", "https://mirrors.ustc.edu.cn/homebrew-core.git"
tap "homebrew/services", "https://github.com/Homebrew/homebrew-services.git"
# Search tool like grep, but optimized for programmers
brew "ack"
# Modern replacement for 'ls'
brew "exa"
# Command-line fuzzy finder written in Go
brew "fzf"
# Improved top (interactive process viewer)
brew "htop"
# User-friendly cURL replacement (command-line HTTP client)
brew "httpie"
# Mac App Store command-line interface
brew "mas"
# Scalable distributed version control system
brew "mercurial"
# Python version management
brew "pyenv"
# Simplified and community-driven man pages
brew "tldr"
# Terminal multiplexer
brew "tmux"
# Display directories as trees (with optional color/HTML output)
brew "tree"
# App to build and share containerized applications and microservices
cask "docker"
# Collaborative team software
cask "figma"
cask "font-fira-code"
cask "font-hack"
cask "font-hack-nerd-font"
# Web browser
cask "google-chrome"
# Free and open-source media player
cask "iina"
# Terminal emulator as alternative to Apple's Terminal app
cask "iterm2"
# File archiver
cask "keka"
# Provides updates to various Microsoft products
cask "microsoft-auto-update"
# Web browser
cask "microsoft-edge"
# Open-source download manager
cask "motrix"
cask "paper"
# HTTP client that helps testing and describing APIs
cask "paw"
# Move and resize windows using keyboard shortcuts or snap areas
cask "rectangle"
# Snip or pin screenshots
cask "snipaste"
# Messaging app with a focus on speed and security
cask "telegram"
# Music streaming service with high fidelity sound and hi-def video quality
cask "tidal"
# Free and open-source hosted hypervisor for x86 virtualization
cask "virtualbox"
# Open-source code editor
cask "visual-studio-code"
mas "Disk Speed Test", id: 425264550
mas "Spark", id: 1176895641
 

Git

.gitignore

# download .gitignore
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -o ~/.gitignore

# set global gitignore
git config --global core.excludesfile ~/.gitignore
 

git alias

通过设置 alias 大大提升生产力。
vim ~/.gitconfig
附上我的 git alias:
[alias]
    st = status
    co = checkout
    cob = checkout -b
    cp = cherry-pick
    br = branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate
    undo = reset HEAD~1 --mixed
    done = !git push origin HEAD
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
    res = !git reset --hard
    wip = !git add -u && git commit -m “WIP”
    showme = !git status && exa -la
 
参考链接🔗见下方,可以结合自己的工作流做定制化修改:
 

Vim

brew install vim
git clone https://github.com/amix/vimrc.git ~/.vim_runtime

# complete version
sh ~/.vim_runtime/install_awesome_vimrc.sh

# basic version
sh ~/.vim_runtime/install_basic_vimrc.sh

常用软件

软件源

下面的软件源仅作为试用体验,如果觉得体验不错,请支持正版。

软件列表

  • clash x pro:科学上网
  • alfred:效率工具
  • rectangle:窗口布局
  • snipaste:截图工具
  • motrix:下载软件
  • IINA:播放器
  • iterm2:终端工具
  • keka:压缩工具
  • bartender 4:状态栏图标管理
  • monitorcontrol: 硬件级屏幕调色
  • vscode
  • bumpr:用于在打开链接时选择浏览器
 

iTerm2

安装

brew install --cask iterm2

配色

设置 iterm2 的配色,推荐 cobalt2:
# clone repo
git clone [email protected]:wesbos/Cobalt2-iterm.git $ZSH_CUSTOM/theme/cobalt2
  • 设置 iterm2:
notion image
  • import 并选择 cobalt2:
notion image
  • 效果:
notion image

zsh & oh-my-zsh

安装 zsh

brew install zsh

安装 oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

配置 oh-my-zsh

主题

# clone repo
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

# set oh-my-zsh theme, `~/.zshrc` 
ZSH_THEME="powerlevel10k/powerlevel10k"

# p10k configure
p10k configure

插件

# highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
 

工具

# install
brew install exa

# set in `~/.zshrc`
if [ -x "$(command -v exa)" ]; then
    alias ls="exa"
		alias ll="exa -l"
    alias la="exa --long --all --group"
fi
  • fzf (fuzzy find, 模糊搜索)
brew install fzf

# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install
brew install tree
  • ack (使用 ack 来代替 grep)
brew install ack
 
 

字体

 
 

Chrome

插件

//TBC
 

小技巧

  • 让窗口最小化 cmd + M
  • 让最小化的窗口快速恢复 cmd + Tab 选中希望恢复的 APP,再按 option
  • 快速切换软件窗口 cmd + Tab