-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·177 lines (149 loc) · 7.68 KB
/
install.sh
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/bash
set -eo pipefail
# Current directory
BASEDIR=$(realpath "$(dirname "$0")")
# Link a file to the target location
link_file() {
source=$1
target=$2
echo "Linking $source to $target..."
# Check if the link already exist
if [ -L "$target" ] && [ "$(readlink "$target")" = "$source" ]; then
return
fi
# If the file exists and is a sym link, remove it
if [ -L "$target" ]; then
rm "$target"
fi
# If the file exists and is not a sym link, back it up
if [ -f "$target" ] || [ -d "$target" ]; then
mv "$target" "$target.backup"
fi
# Create the link
ln -s "$source" "$target"
}
# Install starship
if ! which starship >/dev/null; then
curl -sS https://starship.rs/install.sh | sh
fi
# Install Brewfile
echo "Installing brew dependencies..."
brew bundle
# Create links
link_file "$BASEDIR/zsh/.secrets.sh" ~/.secrets.sh
link_file "$BASEDIR/zsh/.zsh_plugins.txt" ~/.zsh_plugins.txt
link_file "$BASEDIR/zsh/.zshrc" ~/.zshrc
link_file "$BASEDIR/starship/starship.toml" ~/.config/starship.toml
link_file "$BASEDIR/ghostty" ~/.config/ghostty
link_file "$BASEDIR/nvim" ~/.config/nvim
link_file "$BASEDIR/tmux" ~/.config/tmux
link_file "$BASEDIR/ranger" ~/.config/ranger
link_file "$BASEDIR/vale" ~/.config/vale
link_file "$BASEDIR/lazygit/config.yml" ~/Library/Application\ Support/lazygit/config.yml
link_file "$BASEDIR/sqlfluff/.sqlfluff" ~/.sqlfluff
link_file "$BASEDIR/karabiner" ~/.config/karabiner
link_file "$BASEDIR/hammerspoon" ~/.hammerspoon
link_file "$BASEDIR/commitizen/.cz.toml" ~/.cz.toml
link_file "$BASEDIR/eza" ~/Library/Application\ Support/eza
link_file "$BASEDIR/spotify-player/theme.toml" ~/.config/spotify-player/theme.toml
link_file "$BASEDIR/tmux/tmux-powerline" "$HOME/.config/tmux-powerline"
# GH
if ! gh auth status >/dev/null; then
gh auth login
fi
gh extension install github/gh-copilot
# Ensure tmux tpm is installed
if [ ! -d "$BASEDIR/tmux/plugins/tpm" ]; then
mkdir -p "$BASEDIR/tmux/plugins"
git clone https://github.com/tmux-plugins/tpm "$BASEDIR/tmux/plugins/tpm"
fi
# Better touch tool
echo 'Setting up bettertouchtool...'
killall "BetterTouchTool" >/dev/null 2>&1 || true
link_file "$BASEDIR/bettertouchtool/library" ~/Library/Application\ Support/BetterTouchTool
cp "$BASEDIR/bettertouchtool/com.hegenberg.BetterTouchTool.plist" ~/Library/Preferences/com.hegenberg.BetterTouchTool.plist
open -n /Applications/BetterTouchTool.app
# Git config
link_file "$BASEDIR/git/.gitconfig" ~/.gitconfig-global
link_file "$BASEDIR/git/.gitignore" ~/.gitignore
if ! grep -q "gitconfig-global" ~/.gitconfig; then
echo "[include]
path = .gitconfig-global" >>~/.gitconfig
fi
# Vale
echo 'Syncing vale...'
(cd ~/.config/vale && vale sync)
# Alt tab
echo 'Setting up alt-tab...'
defaults import com.lwouis.alt-tab-macos "$BASEDIR/alttab/com.lwouis.alt-tab-macos.plist"
if pgrep -x "AltTab" >/dev/null; then
killall "AltTab" >/dev/null 2>&1 || true
fi
open -n /Applications/AltTab.app
# Ensure app are started
echo 'Starting applications...'
if ! pgrep -x "Hammerspoon" >/dev/null; then
open -n /Applications/Hammerspoon.app
fi
open -n /Applications/Karabiner-Elements.app
# Macos settings
echo 'Applying macos settings...'
defaults write NSGlobalDomain AppleShowAllExtensions -bool true # Always show extensions
defaults write com.apple.Finder AppleShowAllFiles -bool false # Do not show hidden files
defaults write com.apple.terminal StringEncodings -array 4 # Set utf8 in terminal
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true # Expand save dialog
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true # Expand save dialog
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 # Enable full keyboard access
defaults write com.apple.finder ShowPathbar -bool true # Show path bar in finder
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true # Expand print dialog
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true # Expand print dialog
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false # Disable auto capitalization
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false # Disable auto correction
defaults write NSGlobalDomain AppleFontSmoothing -int 1 # Enable subpixel font rendering on non-Apple LCDs
defaults write com.apple.finder ShowStatusBar -bool true # Show status bar
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true # Display full POSIX path as Finder window title
defaults write com.apple.finder _FXSortFoldersFirst -bool true # Keep folders on top when sorting by name
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false # Disable the warning when changing a file extension
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true # Disable .DS_Store on network volumes
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true # Disable .DS_Store on USB volumes
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" # Use list view in all Finder windows by default
defaults write com.apple.finder NewWindowTarget -string "PfHm" # Set home as default finder location
defaults write com.apple.dock expose-group-by-app -bool false # Don’t group windows by application in Mission Control
defaults write com.apple.dock autohide-delay -float 0 # Remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-time-modifier -float 0 # Remove the animation when hiding/showing the Dock
defaults write com.apple.dock autohide -bool true # Automatically hide and show the Dock
defaults write com.apple.dock show-recents -bool false # Don't show recent applications in Dock
defaults write com.apple.dock no-bouncing -bool TRUE # Disable bouncing in dock
sudo defaults write com.apple.Safari AutoFillFromAddressBook -bool false # Disable AutoFill in safari
sudo defaults write com.apple.Safari AutoFillPasswords -bool false # Disable AutoFill in safari
sudo defaults write com.apple.Safari AutoFillCreditCardData -bool false # Disable AutoFill in safari
sudo defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false # Disable AutoFill in safari
sudo defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true # Update extensions automatically
# Restart apps modified
for app in Finder Dock SystemUIServer Safari; do killall "$app" || true; done
# ASDF
echo 'Setting up asdf...'
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs latest
asdf global nodejs latest
asdf plugin-add rust https://github.com/asdf-community/asdf-rust.git
asdf install rust latest
asdf global rust latest
asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
asdf install golang latest
asdf global golang latest
asdf plugin-add python https://github.com/asdf-community/asdf-python.git
asdf install python 3.12.0
asdf global python 3.12.0
# Golang
go install golang.org/x/tools/cmd/goimports@latest
# Node
echo 'Installing node dependencies...'
npm i -g npm-check-updates neovim
# Python
echo 'Installing python dependencies...'
pipx install pylatexenc
pip3 install --user neovim
# Weather
echo 'Installing yr (weather)...'
go install git.sr.ht/~timharek/yr@latest