-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_symlinks.sh
More file actions
executable file
·41 lines (34 loc) · 966 Bytes
/
create_symlinks.sh
File metadata and controls
executable file
·41 lines (34 loc) · 966 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
#!/bin/bash
########################################################
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
bak=~/backup-dotfiles
dotfiles="zshrc bashrc gitconfig agignore latexmkrc tmux.conf hyper.js"
folders="nvim"
read -r -p "Symlink dotfiles? [y/N] " response
response=${response,,}
if [[ $response =~ ^(yes|y)$ ]]; then
echo "Storing dot files at $bak ..."
mkdir -p $bak
for file in $dotfiles; do
if [ -L ~/.$file ]; then
rm ~/.$file
elif [ -f ~/.$file ]; then
mv ~/.$file $bak
fi
done
echo "Now creating symbolic links for new dot files"
for file in $dotfiles; do
ln -sf $dir/.$file ~/.$file
done
fi
read -r -p "Symlink init.vim? [y/N] " response
response=${response,,}
if [[ $response =~ ^(yes|y)$ ]]; then
echo "Symlinking neovim"
mkdir -p ~/.config
if [ -d ~/.config/nvim ]; then
mv ~/.config/nvim $bak
fi
ln -sf $dir/nvim ~/.config/nvim
fi
echo "Done successfully!"