-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·110 lines (83 loc) · 3.41 KB
/
setup.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
#!/bin/bash
git_clone() {
git clone "https://github.com/$1" "$2" --depth 1
}
# Install homebrew
bash -c "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ $(uname -m) == 'arm64' ]]; then
BREW="/opt/homebrew/bin/brew"
else
BREW="/usr/local/bin/brew"
fi
BREW_PREFIX=$("$BREW" --prefix)
DOTFILES="${HOME}/workspace/dotfiles"
ITERM_CONFIG_DIR="${HOME}/.iterm2"
K9S_CONFIG_PATH="${HOME}/Library/Application\ Support/k9s"
ZSH_CUSTOM="${HOME}/.oh-my-zsh/custom"
# Brew
"$BREW" update
# Install what I need
"$BREW" bundle --file ./brewfile
# Install oh-my-zsh
sh -c "$(curl -fsSL \
https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
mv "${HOME}/.zshrc" "${HOME}/.zshrc.bak"
ln -s "${DOTFILES}/zsh/zshrc" "${HOME}/.zshrc"
if [ "${ZSH_CUSTOM+x}" = "" ]; then
ZSH_CUSTOM="${HOME}/.oh-my-zsh/custom"
else
echo "ZSH_CUSTOM is set to '$ZSH_CUSTOM'"
fi
touch "${ZSH_CUSTOM}/secrect_alias.zsh"
mkdir "${HOME}/workspace"
# Install zsh plugins
curl https://raw.githubusercontent.com/kaplanelad/shellfirm/main/shell-plugins/shellfirm.plugin.oh-my-zsh.zsh \
--create-dirs -o "${ZSH_CUSTOM}/plugins/shellfirm/shellfirm.plugin.zsh"
git_clone "TamCore/autoupdate-oh-my-zsh-plugins" "${ZSH_CUSTOM}/plugins/autoupdate"
git_clone "clarketm/zsh-completions" "${ZSH_CUSTOM}/plugins/zsh-completions"
# Install and configure p10k
git_clone "romkatv/powerlevel10k.git" "${ZSH_CUSTOM}/themes/powerlevel10k"
mv "${HOME}/.p10k.zsh" "${HOME}/.p10k.zsh.bak"
ln -s "${DOTFILES}/p10k/p10k.zsh" "${HOME}/.p10k.zsh"
# Install k9s catpuccin theme
git_clone "catppuccin/k9s.git" "${K9S_CONFIG_PATH}/skins/catpuccin"
cp "${K9S_CONFIG_PATH}/skins/catpuccin/dist/mocha.yml" "${K9S_CONFIG_PATH}/skin.yml"
# Configure neovim
git_clone "NvChad/NvChad.git" "${HOME}/.config/nvim"
ln -s "${DOTFILES}/nvim" "${HOME}/.config/nvim/lua/custom"
# Configure iTerm
mkdir "$ITERM_CONFIG_DIR"
cp "${DOTFILES}/iterm/com.googlecode.iterm2.plist" "$ITERM_CONFIG_DIR"
# # Specify the preferences directory
defaults write com.googlecode.iterm2 PrefsCustomFolder -string "$ITERM_CONFIG_DIR"
# Tell iTerm2 to use the custom preferences in the directory
defaults write com.googlecode.iterm2 LoadPrefsFromCustomFolder -bool true
# Configure Karabiner
cp "${DOTFILES}/karabiner/karabiner.json" "${HOME}/.config/karabiner/karabiner.json"
# Configure zellij
mkdir -p "${HOME}/.config/zellij"
ln -s "${DOTFILES}/zellij/config.kdl" "${HOME}/.config/zellij/config.kdl"
# Add useful stuff to alias.zsh
cat <<EOT >>"${ZSH_CUSTOM}/alias.zsh"
export PATH=/usr/local/opt/python/libexec/bin:${HOME}/bin:/usr/local/bin:${BREW_PREFIX}/bin:${PATH}
# Source secret aliases
source ${ZSH_CUSTOM}/secrect_alias.zsh
# Configure zsh-syntax-highlighting.zsh
source ${BREW_PREFIX}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Configure zsh-autosuggestions
source ${BREW_PREFIX}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# Configure zsh-history-substring-search
source ${BREW_PREFIX}/share/zsh-history-substring-search/zsh-history-substring-search.zsh
alias python='${BREW_PREFIX}/bin/python3'
alias vi='${BREW_PREFIX}/bin/nvim'
alias vimdiff='${BREW_PREFIX}/bin/nvim -d'
alias k='${BREW_PREFIX}/bin/kubectl'
alias ls='${BREW_PREFIX}/bin/eza --git --icons --sort type'
alias ws='cd ${HOME}/workspace'
alias c='clear'
alias compile='g++ -Wall -Werror -pedantic -std=c++1y -o a.out'
EOT
# Change shell to zsh
/usr/bin/chsh -s /bin/zsh
exit 0