-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·163 lines (137 loc) · 4.97 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
#!/bin/bash
exist() {
if type $1 >/dev/null 2>&1; then
return 1
fi
return 0
}
export DOTFILES_HOME=~/.dotfiles
if [ ! -d "$DOTFILES_HOME" ]; then
git clone https://github.com/locol23/dotfiles.git $DOTFILES_HOME
CURRENT_DIRECTORY=$(pwd)
cd $DOTFILES_HOME
git remote set-url origin [email protected]:locol23/dotfiles.git
cd $CURRENT_DIRECTORY
# Mac
# Dock
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0.7
defaults write com.apple.dock magnification -bool true
defaults write com.apple.dock mineffect -string "scale"
defaults write com.apple.dock mru-spaces -bool "false"
defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock show-recents -bool "false"
defaults write com.apple.dock tilesize -int 55
killall Dock
# Keyboad
defaults write -g InitialKeyRepeat -int 15
defaults write -g KeyRepeat -int 1
# Trackpad
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool "true"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool "true"
defaults -currentHost write -g com.apple.mouse.tapBehavior -bool "true"
defaults write -g com.apple.trackpad.scaling 3
defaults write com.apple.AppleMultitouchTrackpad TrackpadFourFingerVertSwipeGesture -int 2
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerVertSwipeGesture -int 0
defaults write com.apple.dock showMissionControlGestureEnabled -boolean true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerVertSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerVertSwipeGesture -int 0
# Battery
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
# Finder
defaults write com.apple.finder DisableAllAnimations -bool true
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Terminal
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Create dotfiles command for updating tools
sudo ln -sf $DOTFILES_HOME/install.sh /usr/local/bin/dotfiles
fi
# Homebrew and Formula
if exist brew; then
export PATH=$PATH:/opt/homebrew/bin
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew bundle --file $DOTFILES_HOME/Brewfile
# Alacritty
ln -sf $DOTFILES_HOME/.alacritty.yml ~/
# Git
ln -sf $DOTFILES_HOME/.gitconfig ~/
ln -sf $DOTFILES_HOME/.gitignore_global ~/
# Mise
if [ ! -d ~/.config/mise ]; then
echo
echo "Install Mise"
echo
mkdir -p ~/.config/mise
ln -sf $DOTFILES_HOME/config.toml ~/.config/mise/config.toml
mise install
fi
# Zsh
if [ ! -d ~/.zsh ]; then
echo
echo "Install Zsh"
echo
sudo sh -c "echo '/opt/homebrew/bin/zsh' >> /etc/shells"
chsh -s '/opt/homebrew/bin/zsh'
ln -sf $DOTFILES_HOME/.zsh/ ~/
ln -sf $DOTFILES_HOME/.zshenv ~/
ln -sf $DOTFILES_HOME/.zshrc ~/
cp $DOTFILES_HOME/.zshrc.local ~/
ln -sf $DOTFILES_HOME/.zprofile ~/
cp $DOTFILES_HOME/.zshrc.local ~/
fi
# Vim
if [ ! -d ~/.config/nvim ]; then
echo
echo "Install Vim"
echo
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
mkdir -p ~/.config/nvim
ln -sf $DOTFILES_HOME/init.vim ~/.config/nvim/init.vim
ln -sf $DOTFILES_HOME/coc-settings.json ~/.config/nvim/coc-settings.json
fi
# VS Code
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false
# AtCoder
if exist oj; then
pipx install online-judge-tools --force
fi
# Golang
if exist go; then
echo
echo "Install Node.js"
echo
go install github.com/bufbuild/buf/cmd/buf@latest
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@latest
fi
# Direnv
ln -sf $DOTFILES_HOME/.direnvrc ~/
# Prettier
ln -sf $DOTFILES_HOME/.prettierrc.js ~/
# Tig
ln -sf $DOTFILES_HOME/.tigrc ~/
# Tmux
ln -sf $DOTFILES_HOME/.tmux.conf ~/
# BTT
ln -sf $DOTFILES_HOME/bttconfig.json ~/bttconfig.json
# Karabiner-Elements
if [ ! -d ~/.config/karabiner ]; then
mkdir -p ~/.config/karabiner
ln -sf $DOTFILES_HOME/karabiner.json ~/.config/karabiner/karabiner.json
fi
# SSH
mkdir -p ~/.ssh
ln -sf $DOTFILES_HOME/.ssh/config ~/.ssh/
exec $SHELL -l