-
Notifications
You must be signed in to change notification settings - Fork 0
/
makesymlinks.sh
54 lines (47 loc) · 1.05 KB
/
makesymlinks.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
#!/bin/bash
#
# Variables
#
dir=$PWD # dotfiles directory
olddir=~/dotfiles_old # old dotfiles backup directory
files="bashrc bash_profile bash_prompt aliases functions config inputrc vimrc vim gitconfig gitignore exports" # list of files/folders to symlink in homedir
#
# create dotfiles_old in homedir
#
echo "Creating $olddir for backup of any existing dotfiles in ~/ ..."
mkdir -p $olddir
echo "... done"
echo ""
#
# change to the dotfiles directory
#
echo "Changing to the $dir directory ..."
cd $dir
echo "... done"
echo ""
#
# move any existing dotfiles in homedir to dotfiles_old directory
#
for file in $files; do
if [ -a ~/.$file ]; then
mv ~/.$file ~/dotfiles_old/
fi
done
#
# create symlinks from the homedir to any files in the ~/dotfiles directory
# specified in $files
#
echo "Creating symlinks in home directory"
for file in $files; do
echo "~/.$file -> $dir/.$file"
ln -s $dir/.$file ~/.$file
done
echo "... done"
echo ""
#
# install VIM plugins
#
echo "Installing VIM plugins for you"
vim +'PlugInstall --sync' +qa
echo "... done"
echo ""