-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupdir.sh
43 lines (35 loc) · 1.2 KB
/
setupdir.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
#!/bin/sh
# Script to setup additional local file directory
echo "Starting local personal file directory setup"
SETUP_DIR=/home/${USER}/.vim/mydir
UNDO_DIR="$SETUP_DIR/undodir"
HOME_UNDO_DIR=/home/$USER/.undodir
SNIP_DIR="$SETUP_DIR/mysnips/"
DIR=`pwd`
# If mydir, undodir and snip directories are already present, abort
if [ -e "$SETUP_DIR" ] && [ -e "$UNDO_DIR" ] && [ -e "$SNIP_DIR" ]; then
exit 1
fi
# If setup directory is not present, make it before you carry on:
if ! [ -e "$SETUP_DIR" ]; then
echo "Creating your local setup directory"
mkdir -p "$SETUP_DIR"
fi
# Move persistent undotree directory if it already exists:
if ! [ -e "$UNDO_DIR" ] && [ -e "$HOME_UNDO_DIR" ]; then
echo "Moving your $HOME_UNDO_DIR to $UNDO_DIR"
mv "$HOME_UNDO_DIR" "$UNDO_DIR"
fi
# Create new persistent undotree directory:
if ! [ -e "$UNDO_DIR" ] && ! [ -e "$HOME_UNDO_DIR" ]; then
echo "Creating new persistent undotree directory"
mkdir -p "$UNDO_DIR"
fi
# Create your personal snippet directory:
if ! [ -e "$SNIP_DIR" ]; then
echo "Creating your local snippet directory"
mkdir -p "$SNIP_DIR"
echo "Creating symbolic link to my personal snippets"
ln -s ${DIR}/UltiSnips /home/${USER}/.vim/mydir/mysnips/
fi
echo "Done."