-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure_neovim.sh
executable file
·55 lines (44 loc) · 1.22 KB
/
configure_neovim.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
#!/bin/bash
set -e
TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S')
removeDirIfPresent() {
if [[ -d $1 ]]; then
rm -rf "$1"
echo "Removed dir '$1'"
fi
}
removeSymbolicLinkIfPresent() {
if [[ -f $1 ]]; then
rm "$1"
echo "Removed symlink '$1'"
fi
}
renameDirIfPresent() {
if [[ -d $1 ]]; then
mv "$1" "$1.$TIMESTAMP"
echo "Renamed '$1' to '$1.$TIMESTAMP'."
fi
}
removeConfiguration() {
removeDirIfPresent ~/.config/nvim
removeDirIfPresent ~/.local/share/nvim
removeDirIfPresent ~/.local/state/nvim
removeDirIfPresent ~/.cache/nvim
}
backupConfiguration() {
renameDirIfPresent ~/.config/nvim
renameDirIfPresent ~/.local/share/nvim
renameDirIfPresent ~/.local/state/nvim
renameDirIfPresent ~/.cache/nvim
}
# echo 'Deleting old setup (if it exists)...'
# removeConfiguration
echo 'Backing up old setup (if it exists)...'
backupConfiguration
echo 'Recreating setup using symlinks from my dot_files repo...'
mkdir -p ~/.config || true
removeSymbolicLinkIfPresent rm ~/.config/nvim
ln -s /storage/src/pde.nvim ~/.config/nvim
echo 'Creating dir to hold the codecompanion chats...'
mkdir -p $HOME//nvim-codecompanion/saved_chats || true
echo 'DONE.'