-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·108 lines (98 loc) · 2.82 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
#!/bin/bash
script_dir=$(dirname "$(readlink -f "$0")")
delimiter="***********"
create_symlinks() {
# Get the directory in which this script lives.
echo "$delimiter Creating symlinks $delimiter"
echo $script_dir
# Get a list of all files in this directory that start with a dot.
files=$(find . -maxdepth 1 -type f -name ".*")
# Create a symbolic link to each file in the home directory.
for file in $files; do
name=$(basename $file)
if [ -n "${CODESPACES}" ]; then
echo "Removing existing $name"
rm -rf ~/$name
fi
echo "Creating symlink to $name in home directory."
ln -s $script_dir/$name ~/$name
done
echo "$delimiter Creating symlinks done $delimiter"
}
install_fonts() {
if [ ! -d "$HOME/fonts" ]; then
echo "$delimiter Installing fonts $delimiter"
FONT_DIR="$HOME/fonts"
git clone https://github.com/powerline/fonts.git $FONT_DIR --depth=1
cd $FONT_DIR
./install.sh
cd ..
rm -rf $FONT_DIR
echo "$delimiter Installing fonts done $delimiter"
fi
}
install_spaceship() {
ZSH_CUSTOM="$HOME/.oh-my-zsh/custom"
if [ ! -d "$ZSH_CUSTOM/themes/spaceship-prompt" ]; then
echo "$delimiter Setting up the Spaceship theme $delimiter"
git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
echo "$delimiter Setting up the Spaceship theme done $delimiter"
fi
}
install_nvim() {
echo "$delimiter Setting up nvim $delimiter"
if [ -n "${CODESPACES}" ]; then
mkdir -p ~/bin
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage --appimage-extract
ln -s "$(pwd)/squashfs-root/usr/bin/nvim" ~/bin/nvim
else
brew install neovim
fi
echo "$delimiter Setting up nvim done $delimiter"
}
install_fx() {
if [ -n "${CODESPACES}" ]; then
curl https://fx.wtf/install.sh | sh
else
brew install fx
fi;
}
install_git_delta() {
if [ ! -n "${CODESPACES}" ]; then
brew install git-delta
else
curl -sS https://webi.sh/delta | sh
ln -s "$(pwd)/.local/share/delta .local/share/delta"
fi
}
merge_zsh_config(){
echo "Copying contents of .zshrc from $HOME/.zshrc to $script_dir/.zshrc"
if [[ -n "$CODESPACES" && -e "$HOME/.zshrc" ]]; then
less "$HOME/.zshrc" >> "$script_dir/.zshrc"
fi
}
codespaces_setup(){
if [ -n "$CODESPACES" ]; then
echo "Codespaces setup"
apt install tmux
fi;
}
local_setup(){
if [ ! -n "$CODESPACES" ]; then
echo "**Local setup**"
echo "Install tmux"
brew install tmux
fi;
}
merge_zsh_config
local_setup
codespaces_setup
install_nvim
create_symlinks
install_fonts
install_spaceship
export SPACESHIP_CONFIG="$(pwd)/.spaceship.zsh"
export PATH="$HOME/.local/bin:$PATH"