-
Notifications
You must be signed in to change notification settings - Fork 6
/
profile
129 lines (102 loc) · 4.27 KB
/
profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env sh
if [ -x "$(command -v brew)" ]; then
BREW_PREFIX="$(brew --prefix)"
else
if [ "$(uname -p)" = 'arm' ]; then
BREW_PREFIX='/opt/homebrew'
else
BREW_PREFIX='/usr/local'
fi
fi
export BREW_PREFIX
if command -v eza > /dev/null; then
alias ls="eza -F --color=auto"
else
alias ls="ls -F --color=auto"
fi
alias ll="ls -l"
alias la="ls -a"
alias vi='vim'
alias vim='nvim'
macos_setup() {
# based on https://mths.be/macos
defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock autohide -boolean true
defaults write com.apple.dock orientation -string left
defaults write -g ApplePressAndHoldEnabled -bool false # Key repeats when you hold it
defaults write com.apple.menuextra.clock DateFormat -string 'EEE MMM d H:mm'
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 # enable full keyboard access
defaults write NSGlobalDomain com.apple.keyboard.fnState -boolean true # enable function keys
# SecureKeyboardEntry for Terminal & iTerm https://security.stackexchange.com/a/47786/8918
defaults write com.apple.terminal SecureKeyboardEntry -bool true
defaults write com.googlecode.iterm2 SecureKeyboardEntry -bool true
# Enable snap-to-grid for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" \
"${HOME}/Library/Preferences/com.apple.finder.plist"
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" \
"${HOME}/Library/Preferences/com.apple.finder.plist"
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" \
"${HOME}/Library/Preferences/com.apple.finder.plist"
# Use list view in all Finder windows by default, other view mode codes: `icnv`, `clmv`, `glyv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Expand “General”, “Open with”, and “Sharing & Permissions” File Info panes:
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true
# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# Bypass the annoyingly slow t.co URL shortener
defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true
}
# Homebrew
export HOMEBREW_NO_ANALYTICS=1 # Turn of homebrew data collection
export HOMEBREW_BUNDLE_NO_LOCK=1 # No brew lockfile
export HOMEBREW_NO_INSECURE_REDIRECT=1 # Disallow `https` => `http` redirects
export HOMEBREW_CASK_OPTS='--require-sha'
export HOMEBREW_BUNDLE_FILE="${HOME}/.Brewfile"
homebrew_git_api_token="${HOME}/.homebrew-git-api-token"
# shellcheck source=/dev/null
test -f "${homebrew_git_api_token}" && . "${homebrew_git_api_token}"
bup() {
brew update
brew bundle cleanup --force --verbose
brew bundle
brew upgrade --greedy
brew cleanup
brew doctor
date '+==> %Y-%m-%d %H:%M:%S'
}
## Golang: This has to happen after GVM otherwise GOPATH will get unset
export GOPATH="${HOME}/go"
export PATH="${PATH}":"${GOPATH}/bin":"${BREW_PREFIX}/go/bin"
## Chruby
chruby_script="${BREW_PREFIX}/share/chruby/chruby.sh"
# shellcheck source=/dev/null
test -f "${chruby_script}" && . "${chruby_script}" && chruby ruby
# ruby-install
rb_inst() {
ruby-install "${@}" -- --disable-install-doc
}
## Git Duet
export GIT_DUET_ROTATE_AUTHOR=1
export GIT_DUET_SET_GIT_USER_CONFIG=1
export GIT_DUET_GLOBAL=true
## Don't check mail when opening terminal.
unset MAILCHECK
## Default Editor
export EDITOR="nvim"
## Force xterm-256color
export TERM="xterm-256color"
## PATH
export PATH="${BREW_PREFIX}/bin":"${BREW_PREFIX}/sbin":"${PATH}"
export PATH="${HOME}/.local/bin":"${HOME}/bin":"${PATH}" # Add ~/.local/bin, ~/bin to PATH