-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·109 lines (87 loc) · 2.57 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
#!/bin/bash
println() {
printf "$@\n"
}
install_dotfiles() {
if [ ! -d ~/.dotfiles ]; then
println "\nCloning Dotfiles"
git clone https://github.com/emilio-desousa/dotfiles.git ~/.dotfiles || exit 1
cd ~/.dotfiles git submodule update --init
fi
}
link_dotfiles() {
println "\nLinking config files"
cd ~/.dotfiles
for folder in conf zsh tmux
do
stow $folder -vv
done
}
install_font() {
the_fonts_dir=fonts/
echo "the_fonts_dir: $the_fonts_dir"
find_command="find \"$the_fonts_dir\" \( -name '*.[o,t]tf' -or -name '*.pcf.gz' \) -type f -print0"
if [[ `uname` == 'Darwin' ]]; then
# MacOS
font_dir="$HOME/Library/Fonts"
else
# Linux
font_dir="$HOME/.local/share/fonts"
mkdir -p $font_dir
fi
echo -e "Run: $find_command | xargs -0 -I % cp \"%\" \"$font_dir/\"\n"
echo "Copying fonts..."
# printing
eval $find_command | xargs -0 -I %
eval $find_command | xargs -0 -I % cp "%" "$font_dir/"
if command -v fc-cache @>/dev/null ; then
echo -e "\nResetting font cache, this may take a moment..."
fc-cache -f $font_dir
fi
echo -e "\nAll fonts have been installed to $font_dir"
}
install_oh_my_zsh() {
if [ -d ~/.oh-my-zsh ]; then
println "${BLUE}\nOh My Zsh already installed"
return 0
fi
println "\nCloning Oh My Zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
println "\nCloning Powerlevel10k"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
}
install_plug_vim() {
local PACKER_FILE="~/.local/share/nvim/site/pack/packer/start/packer.nvim"
if [[ -f $PACKER_FILE ]]; then
println "\nPacker Vim is already installed"
return 0
fi
println "\nInstalling Packer"
git clone --depth 1 https://github.com/wbthomason/packer.nvim $PACKER_FILE
}
install_plug_tmux() {
if [ -d ~/.tmux ]; then
println "Tmux Plugin Manager already installed"
return 0
fi
println "Installing Tmux Plugin Manager"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
}
install_kitty(){
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
}
change_shell() {
if [[ $SHELL != "/bin/zsh" ]]; then
println "Changing default shell to zsh..."
chsh -s /bin/zsh
fi
}
main() {
install_dotfiles
install_font
link_dotfiles
install_plug_vim
change_shell
install_plug_tmux
}
main