Skip to content

Commit 9c9ed40

Browse files
committed
Merge remote-tracking branch 'upstream/main' into develop
* upstream/main: readme: fix link to lri’s old notes .macos: adjust toolbar title rollover delay .gitconfig: Rely on Git v2.28’s `init.defaultBranch` .gitconfig: delete `mpr` alias .gitconfig: show most recent branches first meta: rename main branch .gitconfig: make `git init` default to `main` instead of `master` (mathiasbynens#926) .gitconfig: improve `git p` alias (mathiasbynens#896) .exports: Hide zsh warning on macOS .macos: fix showing ~/Library folder in macOS 10.15 (Catalina) (mathiasbynens#917) .gitconfig: Add `g whoami` README: Fix link (mathiasbynens#902) .bash_prompt: Exit early for Chromium/Blink repo .macos: Also disable Java for local domains in Safari (mathiasbynens#769) .macos: Consolidate energy management settings .gitconfig: Simplify `git p` alias .macos: Add Hot Corner option for Lock Screen (13) .macos: Replace `Flwv` with `glyv` (mathiasbynens#886) .aliases: Make `mergepdf` preserve hyperlinks # Conflicts: # .bash_prompt # .exports # .gitconfig # .macos # README.md # brew.sh
2 parents 5b77624 + 66ba9b3 commit 9c9ed40

File tree

9 files changed

+99
-107
lines changed

9 files changed

+99
-107
lines changed

.aliases

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && k
108108
# URL-encode strings
109109
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
110110

111-
# Merge PDF files
112-
# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf`
113-
alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py'
111+
# Merge PDF files, preserving hyperlinks
112+
# Usage: `mergepdf input{1,2,3}.pdf`
113+
alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.pdf'
114114

115115
# Disable Spotlight
116116
alias spotoff="sudo mdutil -a -i off"
@@ -133,9 +133,6 @@ for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
133133
alias "${method}"="lwp-request -m '${method}'"
134134
done
135135

136-
# Make Grunt print stack traces by default
137-
command -v grunt > /dev/null && alias grunt="grunt --stack"
138-
139136
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
140137
alias stfu="osascript -e 'set volume output muted true'"
141138
alias pumpitup="osascript -e 'set volume output volume 100'"

.bash_prompt

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,45 @@ prompt_git() {
1616
local branchName='';
1717

1818
# Check if the current directory is in a Git repository.
19-
if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then
20-
21-
# check if the current directory is in .git before running git checks
22-
if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then
23-
24-
# Ensure the index is up to date.
25-
git update-index --really-refresh -q &>/dev/null;
26-
27-
# Check for uncommitted changes in the index.
28-
if ! $(git diff --quiet --ignore-submodules --cached); then
29-
s+='+';
30-
fi;
31-
32-
# Check for unstaged changes.
33-
if ! $(git diff-files --quiet --ignore-submodules --); then
34-
s+='!';
35-
fi;
36-
37-
# Check for untracked files.
38-
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
39-
s+='?';
40-
fi;
41-
42-
# Check for stashed files.
43-
if $(git rev-parse --verify refs/stash &>/dev/null); then
44-
s+='$';
45-
fi;
46-
19+
git rev-parse --is-inside-work-tree &>/dev/null || return;
20+
21+
# Check for what branch we’re on.
22+
# Get the short symbolic ref. If HEAD isn’t a symbolic ref, get a
23+
# tracking remote branch or tag. Otherwise, get the
24+
# short SHA for the latest commit, or give up.
25+
branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \
26+
git describe --all --exact-match HEAD 2> /dev/null || \
27+
git rev-parse --short HEAD 2> /dev/null || \
28+
echo '(unknown)')";
29+
30+
# Early exit for Chromium & Blink repo, as the dirty check takes too long.
31+
# Thanks, @paulirish!
32+
# https://github.com/paulirish/dotfiles/blob/dd33151f/.bash_prompt#L110-L123
33+
repoUrl="$(git config --get remote.origin.url)";
34+
if grep -q 'chromium/src.git' <<< "${repoUrl}"; then
35+
s+='*';
36+
else
37+
# Check for uncommitted changes in the index.
38+
if ! $(git diff --quiet --ignore-submodules --cached); then
39+
s+='+';
4740
fi;
41+
# Check for unstaged changes.
42+
if ! $(git diff-files --quiet --ignore-submodules --); then
43+
s+='!';
44+
fi;
45+
# Check for untracked files.
46+
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
47+
s+='?';
48+
fi;
49+
# Check for stashed files.
50+
if $(git rev-parse --verify refs/stash &>/dev/null); then
51+
s+='$';
52+
fi;
53+
fi;
4854

49-
# Get the short symbolic ref.
50-
# If HEAD isn't a symbolic ref, get the short SHA for the latest commit
51-
# Otherwise, just give up.
52-
branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \
53-
git rev-parse --short HEAD 2> /dev/null || \
54-
echo '(unknown)')";
55-
56-
[ -n "${s}" ] && s=" [${s}]";
55+
[ -n "${s}" ] && s=" [${s}]";
5756

58-
echo -e "${1}${branchName}${2}${s}";
59-
else
60-
return;
61-
fi;
57+
echo -e "${1}${branchName}${2}${s}";
6258
}
6359

6460
if tput setaf 1 &> /dev/null; then

.exports

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export MANPAGER='less -X';
3333
# https://stackoverflow.com/a/42265848/96656
3434
export GPG_TTY=$(tty);
3535

36-
# Some additional bins
36+
# Hide the "default interactive shell is now zsh" warning on macOS.
37+
export BASH_SILENCE_DEPRECATION_WARNING=1;
38+
39+
# Some additional bins
3740
export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"
3841
export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"

.gitconfig

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
[alias]
22

3-
# View abbreviated SHA, description, and history graph of the latest 20 commits
3+
# View abbreviated SHA, description, and history graph of the latest 20 commits.
44
l = log --pretty=oneline -n 20 --graph --abbrev-commit
55

6-
# View the current working tree status using the short format
6+
# View the current working tree status using the short format.
77
s = status -s
88

9-
# Show the diff between the latest commit and the current state
9+
# Show the diff between the latest commit and the current state.
1010
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
1111

12-
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
12+
# `git di $number` shows the diff between the state `$number` revisions ago and the current state.
1313
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
1414

15-
# Pull in remote changes for the current repository and all its submodules
16-
p = !"git pull; git submodule foreach git pull origin master"
15+
# Pull in remote changes for the current repository and all its submodules.
16+
p = pull --recurse-submodules
1717

18-
# Clone a repository including all submodules
18+
# Clone a repository including all submodules.
1919
c = clone --recursive
2020

21-
# Commit all changes
21+
# Commit all changes.
2222
ca = !git add -A && git commit -av
2323

24-
# Switch to a branch, creating it if necessary
24+
# Switch to a branch, creating it if necessary.
2525
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
2626

2727
# Show verbose output about tags, branches or remotes
2828
tags = tag -l
29-
branches = branch -a
30-
remotes = remote -v
29+
branches = branch --all
30+
remotes = remote --verbose
3131

32-
# List aliases
32+
# List aliases.
3333
aliases = config --get-regexp alias
3434

35-
# Amend the currently staged files to the latest commit
35+
# Amend the currently staged files to the latest commit.
3636
amend = commit --amend --reuse-message=HEAD
3737

38-
# Credit an author on the latest commit
38+
# Credit an author on the latest commit.
3939
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
4040

41-
# Interactive rebase with the given number of latest commits
41+
# Interactive rebase with the given number of latest commits.
4242
reb = "!r() { git rebase -i HEAD~$1; }; r"
4343

4444
# Remove the old tag with this name and tag the latest commit with it.
@@ -60,48 +60,40 @@
6060
# a.k.a. ‘delete merged'
6161
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
6262

63-
# List contributors with number of commits
63+
# List contributors with number of commits.
6464
contributors = shortlog --summary --numbered
6565

66-
# Merge GitHub pull request on top of the current branch or,
67-
# if a branch name is specified, on top of the specified branch
68-
mpr = "!f() { \
69-
declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \
70-
declare branch=\"${2:-$currentBranch}\"; \
71-
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
72-
git fetch origin refs/pull/$1/head:pr/$1 && \
73-
git checkout -B $branch && \
74-
git rebase $branch pr/$1 && \
75-
git checkout -B $branch && \
76-
git merge pr/$1 && \
77-
git branch -D pr/$1 && \
78-
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
79-
fi \
80-
}; f"
81-
82-
# "Delete untracked" removes stale local branches with no tracked upstream branch
83-
dut = "!f() { \
84-
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | \
85-
awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'); do git branch -D $branch; done; \
86-
}; f"
66+
# Show the user email for the current repository.
67+
whoami = config user.email
68+
69+
# "Delete untracked" removes stale local branches with no tracked upstream branch
70+
dut = "!f() { \
71+
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | \
72+
awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'); do git branch -D $branch; done; \
73+
}; f"
8774

8875
[apply]
8976

90-
# Detect whitespace errors when applying a patch
77+
# Detect whitespace errors when applying a patch.
9178
whitespace = fix
9279

80+
[branch]
81+
82+
# Show most recently changed branches first.
83+
sort = -committerdate
84+
9385
[core]
9486

95-
# Use custom `.gitignore` and `.gitattributes`
87+
# Use custom `.gitignore` and `.gitattributes`.
9688
excludesfile = ~/.gitignore
9789
attributesfile = ~/.gitattributes
9890

99-
# Treat spaces before tabs and all kinds of trailing whitespace as an error
91+
# Treat spaces before tabs and all kinds of trailing whitespace as an error.
10092
# [default] trailing-space: looks for spaces at the end of a line
10193
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
10294
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
10395

104-
# Make `git rebase` safer on macOS
96+
# Make `git rebase` safer on macOS.
10597
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
10698
trustctime = false
10799

@@ -141,21 +133,21 @@
141133
[commit]
142134

143135
# https://help.github.com/articles/signing-commits-using-gpg/
144-
gpgsign = false
136+
gpgsign = true
145137

146138
[diff]
147139

148-
# Detect copies as well as renames
140+
# Detect copies as well as renames.
149141
renames = copies
150142

151143
[diff "bin"]
152144

153-
# Use `hexdump` to diff binary files
145+
# Use `hexdump` to diff binary files.
154146
textconv = hexdump -v -C
155147

156148
[help]
157149

158-
# Automatically correct and execute mistyped commands
150+
# Automatically correct and execute mistyped commands.
159151
autocorrect = 1
160152

161153
[merge]
@@ -192,6 +184,10 @@
192184

193185
insteadOf = "gist:"
194186

187+
[init]
188+
189+
defaultBranch = main
190+
195191
[gpg]
196192
program = /usr/local/bin/gpg
197193

.macos

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
7474
# Disable auto-correct
7575
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
7676

77-
###############################################################################
78-
# SSD-specific tweaks #
79-
###############################################################################
80-
81-
# Disable hibernation (speeds up entering sleep mode)
82-
sudo pmset -a hibernatemode 0
77+
# Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and
78+
# all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`.
79+
#rm -rf ~/Library/Application Support/Dock/desktoppicture.db
80+
#sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg
81+
#sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg
8382

8483
###############################################################################
8584
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
@@ -124,7 +123,7 @@ defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
124123
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
125124

126125
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
127-
defaults write com.apple.screencapture type -string "jpg"
126+
defaults write com.apple.screencapture type -string "png"
128127

129128
# Disable shadow in screenshots
130129
defaults write com.apple.screencapture disable-shadow -bool true
@@ -225,7 +224,7 @@ defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
225224
# /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
226225

227226
# Use list view in all Finder windows by default
228-
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
227+
# Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv`
229228
#defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
230229

231230
# Disable the warning before emptying the Trash
@@ -235,7 +234,7 @@ defaults write com.apple.finder WarnOnEmptyTrash -bool false
235234
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
236235

237236
# Show the ~/Library folder
238-
chflags nohidden ~/Library
237+
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
239238

240239
# Show the /Volumes folder
241240
sudo chflags nohidden /Volumes

.osx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# 301 https://github.com/mathiasbynens/dotfiles/blob/master/.macos
1+
# 301 https://github.com/mathiasbynens/dotfiles/blob/main/.macos

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ set -- -f; source bootstrap.sh
5353
To install these dotfiles without Git:
5454

5555
```bash
56-
cd; curl -#L https://github.com/mathiasbynens/dotfiles/tarball/master | tar -xzv --strip-components 1 --exclude={README.md,bootstrap.sh,.osx,LICENSE-MIT.txt}
56+
cd; curl -#L https://github.com/mathiasbynens/dotfiles/tarball/main | tar -xzv --strip-components 1 --exclude={README.md,bootstrap.sh,.osx,LICENSE-MIT.txt}
5757
```
5858

5959
To update later on, just run that command again.
6060

6161
### Specify the `$PATH`
6262

63-
If `~/.path` exists, it will be sourced along with the other files, before any feature testing (such as [detecting which version of `ls` is being used](https://github.com/mathiasbynens/dotfiles/blob/aff769fd75225d8f2e481185a71d5e05b76002dc/.aliases#L21-26)) takes place.
63+
If `~/.path` exists, it will be sourced along with the other files, before any feature testing (such as [detecting which version of `ls` is being used](https://github.com/mathiasbynens/dotfiles/blob/aff769fd75225d8f2e481185a71d5e05b76002dc/.aliases#L21-L26)) takes place.
6464

6565
Here's an example `~/.path` file that adds `/usr/local/bin` to the `$PATH`:
6666

@@ -123,7 +123,7 @@ Suggestions/improvements
123123
* [Cătălin Mariș](https://github.com/alrra) and his [dotfiles repository](https://github.com/alrra/dotfiles)
124124
* [Gianni Chiappetta](https://butt.zone/) for sharing his [amazing collection of dotfiles](https://github.com/gf3/dotfiles)
125125
* [Jan Moesen](http://jan.moesen.nu/) and his [ancient `.bash_profile`](https://gist.github.com/1156154) + [shiny _tilde_ repository](https://github.com/janmoesen/tilde)
126-
* [Lauri Lri' Ranta](http://lri.me/) for sharing [loads of hidden preferences](http://osxnotes.net/defaults.html)
126+
* Lauri 'Lri' Ranta for sharing [loads of hidden preferences](https://web.archive.org/web/20161104144204/http://osxnotes.net/defaults.html)
127127
* [Matijs Brinkhuis](https://matijs.brinkhu.is/) and his [dotfiles repository](https://github.com/matijs/dotfiles)
128128
* [Nicolas Gallagher](http://nicolasgallagher.com/) and his [dotfiles repository](https://github.com/necolas/dotfiles)
129129
* [Sindre Sorhus](https://sindresorhus.com/)

bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
cd "$(dirname "${BASH_SOURCE}")";
44

5-
git pull origin master;
5+
git pull origin main;
66

77
function doIt() {
88
rsync --exclude ".git/" \

brew.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ brew install moreutils
2222
brew install findutils
2323
# Install GNU `sed`, overwriting the built-in `sed`.
2424
brew install gnu-sed --with-default-names
25-
# Install Bash 4.
25+
# Install a modern version of Bash.
2626
brew install bash
2727
brew install bash-completion@2
2828

@@ -83,6 +83,7 @@ brew install ack
8383
#brew install exiv2
8484
brew install git
8585
brew install git-lfs
86+
#brew install gs
8687
#brew install imagemagick --with-webp
8788
brew install lua
8889
#brew install lynx

0 commit comments

Comments
 (0)