-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.sh
executable file
·73 lines (62 loc) · 2.24 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
#! /bin/sh
# magicTmux message
echo "\033[31m _ "
echo " (_) "
echo " _ __ ___ __ _ __ _ _ ___ "
echo " | '_ \` _ \\ / _\` | / _\` || | / __|"
echo " | | | | | || (_| || (_| || || (__ "
echo " |_| |_| |_| \\__,_| \\__, ||_| \\___|"
echo " __/ | "
echo " |___/ "
echo "\033[35m _______ "
echo " |__ __| "
echo " | | _ __ ___ _ _ __ __ "
echo " | || '_ \` _ \\ | | | |\\ \\/ / "
echo " | || | | | | || |_| | > < "
echo " |_||_| |_| |_| \\__,_|/_/\\_\\ "
dialog() {
echo "\033[32m$1\033[34m"
}
clone() {
dialog "\nInstalling $1..."
git clone $2 $3
}
mkdirIfNeeded() {
if [ ! -d $1 ]; then
mkdir $1
fi
}
echo "\033[33m\n... Is now installing"
# Backup existing tmux configs (if needed)
bakupDir=~/.tmux-config-bakups
bakupDate=$(date +"%Y-%m-%d(%T)")
if [ -d ~/.tmux/ ]; then
dialog "backing up ~/.tmux to ${backupDir}/${bakupDate}/tmux..."
mkdirIfNeeded $bakupDir
mkdirIfNeeded $bakupDir/$bakupDate/
mv ~/.tmux $bakupDir/$bakupDate/tmux/
fi
if [ -f ~/.tmux.conf ]; then
dialog "backing up ~/.tmux.conf to ${bakupDir}${bakupDate}/tmux.conf..."
mkdirIfNeeded $bakupDir
mkdirIfNeeded $bakupDir/$bakupDate/
mv ~/.tmux.conf $bakupDir/$bakupDate/tmux.conf
fi
# download files...
dialog "\nfetching tmux.conf..."
touch ~/.tmux.conf
curl -s https://raw.githubusercontent.com/p-z-l/magicTmux/master/tmux.conf -o ~/.tmux.conf
clone "Tmux Plugin Manager (TPM)" https://github.com/tmux-plugins/tpm.git ~/.tmux/plugins/tpm
clone "tmux-battery" https://github.com/tmux-plugins/tmux-battery.git ~/.tmux/plugins/tmux-battery
clone "tmux-cpu" https://github.com/tmux-plugins/tmux-cpu.git ~/.tmux/plugins/tmux-cpu
clone "tmux-prefix-highlight" https://github.com/tmux-plugins/tmux-prefix-highlight.git ~/.tmux/plugins/tmux-prefix-highlight
# reload tmux config
tmux source-file ~/.tmux.conf
dialog "magicTmux installation Finished"
# tell user to launch tmux if needed
if -f $TMUX
then
echo "Use command \"tmux\" to launch tmux"
fi
echo "\033[34mMore about magicTmux, visit: \033[0mhttps://github.com/p-z-l/magicTmux"
echo "\n\033[0m"