-
Notifications
You must be signed in to change notification settings - Fork 0
/
magic.sh
executable file
·116 lines (91 loc) · 3.54 KB
/
magic.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
#!/usr/bin/env bash
command_exists() {
type "$1" > /dev/null 2>&1
}
echo "Installing dotfiles."
source scripts/git.sh
# only perform macOS-specific install
if [ "$(uname)" == "Darwin" ]; then
echo -e "\\n\\nRunning on macOS"
if test ! "$( command -v brew )"; then
echo "Installing homebrew"
ruby -e "$( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
fi
# install brew dependencies from Brewfile
brew bundle --file=./Brewfile
source scripts/link.sh
# clone vundle into dotfiles associated folder
if [ ! -d "$HOME/.dotfiles/config/nvim/bundle" ]; then
echo "Creating ~/.dotfiles/config/nvim/bundle"
mkdir -p "$HOME/.dotfiles/config/nvim/bundle"
fi
if [ -e "$HOME/.dotfiles/config/nvim/bundle/VundleVim" ]; then
echo "~/.dotfiles/config/nvim/bundle/VundleVim already exists... Skipping."
else
echo "Cloning VundleVim"
git clone https://github.com/VundleVim/Vundle.vim.git ~/.dotfiles/config/nvim/bundle/VundleVim
fi
# download vim-plug into dotfiles associated folder
if [ -e "$HOME/.dotfiles/config/nvim/autoload/plug.vim" ]; then
echo "VimPlug already installed"
else
curl -fLo ~/.dotfiles/config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
# download tmux-plugins into dotfiles associated folder
if [ -e "$HOME/.dotfiles/tmux/plugins/tpm" ]; then
echo "tmux plugin manager already installed"
else
mkdir -p "$HOME/.dotfiles/config/tmux/plugins"
git clone https://github.com/tmux-plugins/tpm $HOME/.dotfiles/tmux/plugins/tpm
fi
# download oh-my-zsh
if [ -e "$HOME/.oh-my-zsh" ]; then
echo "oh-my-zsh is already installed"
else
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
# download powerlevel10k into zsh custom folder
if [ -e "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k" ]; then
echo "powerlevel10k already installed"
else
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
fi
# After the install, setup fzf
echo -e "\\n\\nRunning fzf install script..."
echo "=============================="
/usr/local/opt/fzf/install --all --no-bash --no-fish
# after the install, install neovim python libraries
echo -e "\\n\\nRunning Neovim Python install"
echo "=============================="
# pip3 install pynvim
# Change the default shell to zsh
zsh_path="$( command -v zsh )"
if ! grep "$zsh_path" /etc/shells; then
echo "adding $zsh_path to /etc/shells"
echo "$zsh_path" | sudo tee -a /etc/shells
fi
if [[ "$SHELL" != "$zsh_path" ]]; then
chsh -s "$zsh_path"
echo "default shell changed to $zsh_path"
fi
fi
echo "creating vim directories"
mkdir -p ~/.vim-tmp
if ! command_exists zsh; then
echo "zsh not found. Please install and then re-run installation scripts"
exit 1
elif ! [[ $SHELL =~ .*zsh.* ]]; then
echo "Configuring zsh as default shell"
chsh -s "$(command -v zsh)"
fi
# Change the default shell to zsh
zsh_path="$( command -v zsh )"
if ! grep "$zsh_path" /etc/shells; then
echo "adding $zsh_path to /etc/shells"
echo "$zsh_path" | sudo tee -a /etc/shells
fi
if [[ "$SHELL" != "$zsh_path" ]]; then
chsh -s "$zsh_path"
echo "default shell changed to $zsh_path"
fi
echo "Done. Reload your terminal."