Skip to content

Commit 6c0f68f

Browse files
committed
chore: refresh macOS developer setup
1 parent 3eb0745 commit 6c0f68f

10 files changed

Lines changed: 322 additions & 1610 deletions

File tree

.aliases

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,30 @@
1-
# Shortcuts
2-
alias ..="cd .."
3-
alias ...="cd ../.."
4-
alias ....="cd ../../.."
5-
alias ~="cd ~"
6-
alias -- -="cd -"
1+
# Navigation
2+
alias ..='cd ..'
3+
alias ...='cd ../..'
4+
alias ....='cd ../../..'
5+
alias -- -='cd -'
76

8-
# Modern replacements
9-
if command -v eza &> /dev/null; then
10-
alias ls="eza --icons --group-directories-first"
11-
alias ll="eza -l --icons --group-directories-first --git"
12-
alias la="eza -la --icons --group-directories-first --git"
7+
# Files
8+
if command -v eza >/dev/null 2>&1; then
9+
alias ls='eza --icons=auto --group-directories-first'
10+
alias ll='eza -l --icons=auto --group-directories-first --git'
11+
alias la='eza -la --icons=auto --group-directories-first --git'
1312
else
1413
alias ll='ls -lGh'
1514
alias la='ls -lGah'
1615
fi
1716

18-
if command -v bat &> /dev/null; then
19-
alias cat="bat"
20-
fi
21-
22-
if command -v rg &> /dev/null; then
23-
alias grep="rg"
24-
fi
25-
2617
# Git
27-
alias g="git"
28-
alias gs="git status"
29-
alias ga="git add"
30-
alias gc="git commit -m"
31-
alias gp="git push"
32-
alias gl="git pull"
33-
alias gco="git checkout"
34-
alias gd="git diff"
35-
alias glog="git log --oneline --graph --decorate --all"
18+
alias g='git'
19+
alias gs='git status'
20+
alias ga='git add'
21+
alias gc='git commit'
22+
alias gp='git push'
23+
alias gl='git pull'
24+
alias gco='git switch'
25+
alias gd='git diff'
26+
alias glog='git log --oneline --graph --decorate --all'
3627

3728
# System
38-
alias zconf="code ~/.zshrc"
39-
alias reload="source ~/.zshrc"
40-
alias update="brew update && brew upgrade && brew cleanup"
41-
42-
# VS Code
43-
alias code="open -a 'Visual Studio Code'"
29+
alias reload='exec zsh'
30+
alias update='brew update && brew upgrade && brew cleanup && mise upgrade'

.gitconfig

Lines changed: 30 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,174 +1,52 @@
11
[alias]
2-
3-
# View abbreviated SHA, description, and history graph of the latest 20 commits
4-
l = log --pretty=oneline -n 20 --graph --abbrev-commit
5-
6-
# View the current working tree status using the short format
7-
s = status -s
8-
9-
# Show the diff between the latest commit and the current state
10-
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
11-
12-
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
13-
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
14-
15-
# Pull in remote changes for the current repository and all its submodules
16-
p = !"git pull; git submodule foreach git pull origin master"
17-
18-
# Clone a repository including all submodules
19-
c = clone --recursive
20-
21-
# Commit all changes
22-
ca = !git add -A && git commit -av
23-
24-
# Switch to a branch, creating it if necessary
25-
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
26-
27-
# Show verbose output about tags, branches or remotes
28-
tags = tag -l
29-
branches = branch -a
30-
remotes = remote -v
31-
32-
# Amend the currently staged files to the latest commit
33-
amend = commit --amend --reuse-message=HEAD
34-
35-
# Credit an author on the latest commit
36-
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
37-
38-
# Interactive rebase with the given number of latest commits
39-
reb = "!r() { git rebase -i HEAD~$1; }; r"
40-
41-
# Remove the old tag with this name and tag the latest commit with it.
42-
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r"
43-
44-
# Find branches containing commit
45-
fb = "!f() { git branch -a --contains $1; }; f"
46-
47-
# Find tags containing commit
48-
ft = "!f() { git describe --always --contains $1; }; f"
49-
50-
# Find commits by source code
51-
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
52-
53-
# Find commits by commit message
54-
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
55-
56-
# Remove branches that have already been merged with master
57-
# a.k.a. ‘delete merged’
58-
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
59-
60-
# List contributors with number of commits
61-
contributors = shortlog --summary --numbered
62-
63-
# Merge GitHub pull request on top of the `master` branch
64-
mpr = "!f() { \
65-
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
66-
git fetch origin refs/pull/$1/head:pr/$1 && \
67-
git rebase master pr/$1 && \
68-
git checkout master && \
69-
git merge pr/$1 && \
70-
git branch -D pr/$1 && \
71-
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
72-
fi \
73-
}; f"
2+
s = status --short --branch
3+
l = log --oneline --graph --decorate -20
4+
d = diff
5+
ds = diff --staged
6+
amend = commit --amend --no-edit
7+
branches = branch --all
8+
remotes = remote --verbose
749

7510
[apply]
76-
77-
# Detect whitespace errors when applying a patch
7811
whitespace = fix
7912

8013
[core]
81-
82-
# Use custom `.gitignore` and `.gitattributes`
83-
excludesfile = ~/.gitignore
84-
attributesfile = ~/.gitattributes
85-
86-
# Treat spaces before tabs and all kinds of trailing whitespace as an error
87-
# [default] trailing-space: looks for spaces at the end of a line
88-
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
14+
pager = delta
8915
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
9016

91-
# Make `git rebase` safer on OS X
92-
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
93-
trustctime = false
94-
95-
# Prevent showing files whose names contain non-ASCII symbols as unversioned.
96-
# http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html
97-
precomposeunicode = false
98-
99-
[color]
100-
101-
# Use colors in Git commands that are capable of colored output when
102-
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
103-
ui = auto
104-
105-
[color "branch"]
106-
107-
current = yellow reverse
108-
local = yellow
109-
remote = green
110-
111-
[color "diff"]
112-
113-
meta = yellow bold
114-
frag = magenta bold # line info
115-
old = red # deletions
116-
new = green # additions
117-
118-
[color "status"]
119-
120-
added = yellow
121-
changed = green
122-
untracked = cyan
17+
[delta]
18+
line-numbers = true
19+
navigate = true
12320

12421
[diff]
125-
126-
# Detect copies as well as renames
22+
colorMoved = default
12723
renames = copies
12824

25+
[fetch]
26+
prune = true
27+
12928
[help]
29+
autocorrect = prompt
30+
31+
[init]
32+
defaultBranch = main
13033

131-
# Automatically correct and execute mistyped commands
132-
autocorrect = 1
34+
[interactive]
35+
diffFilter = delta --color-only
13336

13437
[merge]
38+
conflictStyle = zdiff3
13539

136-
# Include summaries of merged commits in newly created merge commit messages
137-
log = true
40+
[pull]
41+
rebase = true
13842

13943
[push]
140-
141-
# Use the Git 1.x.x default to avoid errors on machines with old Git
142-
# installations. To use `simple` instead, add this to your `~/.extra` file:
143-
# `git config --global push.default simple`. See http://git.io/mMah-w.
144-
default = matching
145-
# Make `git push` push relevant annotated tags when pushing branches out.
44+
autoSetupRemote = true
45+
default = simple
14646
followTags = true
14747

148-
# URL shorthands
149-
150-
[url "git@github.com:"]
151-
152-
insteadOf = "gh:"
153-
pushInsteadOf = "github:"
154-
pushInsteadOf = "git://github.com/"
155-
156-
[url "git://github.com/"]
157-
158-
insteadOf = "github:"
159-
160-
[url "git@gist.github.com:"]
161-
162-
insteadOf = "gst:"
163-
pushInsteadOf = "gist:"
164-
pushInsteadOf = "git://gist.github.com/"
165-
166-
[url "git://gist.github.com/"]
48+
[rebase]
49+
autoStash = true
16750

168-
insteadOf = "gist:"
169-
[user]
170-
name = Paul
171-
email = phanminh65@gmail.com
172-
signingkey = 02D7840A0C609597
173-
[commit]
174-
gpgsign = true
51+
[include]
52+
path = ~/.gitconfig.local

.github/workflows/check.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
check:
12+
runs-on: macos-latest
13+
steps:
14+
- uses: actions/checkout@v7
15+
- run: brew install shellcheck
16+
- run: shellcheck setup.sh
17+
- run: ./setup.sh --check

.gitignore

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,10 @@
1-
# IntelliJ IDEA IDE
2-
.idea
3-
4-
# Compiled Python files
5-
*.pyc
6-
7-
# Folder view configuration files
81
.DS_Store
9-
Desktop.ini
10-
11-
# Thumbnail cache files
122
._*
13-
Thumbs.db
14-
15-
# Files that might appear on external disks
16-
.Spotlight-V100
17-
.Trashes
18-
19-
# Files that contain credentials or personal info
20-
.extra
21-
.boto
22-
.mrjob.conf
23-
.s3cfg
24-
.aws/
25-
26-
# Repo scratch directory
27-
scratch/
28-
29-
# Setup logs
30-
.setup-logs/
31-
32-
# Brewfile lock
3+
.idea/
4+
*.pyc
5+
__pycache__/
6+
.zcompdump*
337
Brewfile.lock.json
8+
*.backup.*
9+
.zshrc.local
10+
.gitconfig.local

0 commit comments

Comments
 (0)