-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·88 lines (80 loc) · 2.27 KB
/
setup.sh
File metadata and controls
executable file
·88 lines (80 loc) · 2.27 KB
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
#!/bin/bash
SKIPALL=false
OVERRIDEALL=false
BACKUPALL=false
CURRDIR=`pwd`
if [ -z "$HOME" ]; then
HOME="$(cd ~; pwd)"
echo $HOME
fi
# clone tpm for tmux
git clone https://github.com/NvChad/NvChad ~/.config/nvim
# clone tpm for tmux
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
function runsymlink {
linkname=$1
link=$2
symlink=$3
if [ "$SKIPALL" = "false" ]; then
if [ -e $link ]; then
if [[ "$OVERRIDEALL" = "false" && "$BACKUPALL" = "false" ]]; then
echo "File already exists: $link"
printf "What do you want to do? [s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all, followed by [ENTER]:"
read decision
fi
case $decision in
["S"]*)
SKIPALL=true
;;
["o","O"]*)
if [ "$decision" = "O" ]; then
OVERRIDEALL=true
fi
if [ -h $link ]; then
unlink $link
else
rm $link
fi
ln -s $symlink $link
;;
["b","B"]*)
if [ "$decision" = "B" ]; then
BACKUPALL=true
fi
if [ -e "$link.bk" ]; then
if [ -h "$link.bk" ]; then
unlink "$link.bk"
else
rm $link
fi
fi
mv $link "$link.bk"
ln -s $symlink $link
;;
esac
else
echo "linking: $link -> $symlink"
ln -s $symlink $link
fi
else
echo "skipping link $linkname: $link -> $symlink"
fi
}
for symlink in `find "$CURRDIR" -name "*.symlink" -not -path "*/vim/**/undo/*" -not -path "*.subsymlink/*"`; do
linkname="$(basename ${symlink%.symlink})"
link="$HOME/.$linkname"
# echo "bar skipping link $linkname: $link -> $symlink"
runsymlink $linkname $link $symlink
done
for symlink in `find "$CURRDIR" -name "*.subsymlink" -not -path "*/vim/**/undo/*"`; do
linkname="$(basename ${symlink%.subsymlink})"
link="$HOME/.$linkname"
for subsymlink in `find "$symlink" -name "*.symlink" -not -path "*/vim/**/undo/*"`; do
relsymlink="$(realpath --relative-to=$symlink $subsymlink)"
relsymlink="${relsymlink%.symlink}"
link="$link/$relsymlink"
# echo "foo skipping link $relsymlink: $link -> $subsymlink"
runsymlink $relsymlink $link $subsymlink
done
done
cd ~/.config/nvim && git checkout v2.0