-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·49 lines (44 loc) · 1.83 KB
/
setup.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
#!/bin/bash
###############################################################################
# CD to this directory, and store off the full path to it for use later.
###############################################################################
pushd $(dirname $0) > /dev/null
THIS_DIR=$(pwd)
###############################################################################
# Ensure that all plugin submodules have been fully checked out.
###############################################################################
printf "Ensuring all plugins are properly checked out...\t"
if git submodule update --init --recursive; then
printf "[Done]\n"
else
printf "[FAILED]\n"
printf "\nFailure during setup. Aborting."
popd > /dev/null
exit 1
fi
###############################################################################
# Remove any existing .vim or .vimrc symlinks.
###############################################################################
unlink $HOME/.vimrc > /dev/null 2>&1
unlink $HOME/.vim > /dev/null 2>&1
###############################################################################
# Set up symlinks to the vim folder and the vimrc file so that vim can find
# the config in this repository.
###############################################################################
printf "Creating symbolic links to vim folder and .vimrc...\t"
RES1=$(ln -sf $THIS_DIR/.vimrc $HOME/.vimrc)
RES2=$(ln -sf $THIS_DIR $HOME/.vim)
if $RES1 && $RES2; then
printf "[Done]\n"
else
printf "[FAILED\n"
printf "\nFailure during setup. Aborting."
unlink $HOME/.vimrc
unlink $HOME/vim
popd /dev/null
exit 2
fi
###############################################################################
# Restore the previous working directory.
###############################################################################
popd > /dev/null