-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall
More file actions
executable file
·46 lines (37 loc) · 894 Bytes
/
install
File metadata and controls
executable file
·46 lines (37 loc) · 894 Bytes
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
#!/bin/bash
dir=~/dotfiles
olddir=~/dotfiles_old
files="tmux.conf zshrc zlogin gitconfig tmuxinator ideavimrc tigrc"
files_xdg="nvim"
function create_backup_dir {
echo "Creating backup dir"
mkdir -p $olddir
}
function create_vim_dirs {
cd $dir
mkdir -p "nvim/tmp/undo"
mkdir -p "nvim/tmp/backup"
mkdir -p "$HOME/.config"
}
function backup_create_symlink {
if [ -f ".$2" ]; then
mv ~/.$2 $olddir
fi
echo "Creating symlink to $2 in home directory."
ln -s $dir/$2 $1$2
}
function backup_create_symlinks {
echo "Backing up dotfiles to $olddir"
cd ~
# Files in home folder
for file in $files; do
backup_create_symlink "$HOME/." "$file"
done
# Files in xdg
for file in $files_xdg; do
backup_create_symlink "$HOME/.config/" "$file"
done
}
create_backup_dir
create_vim_dirs
backup_create_symlinks