-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·78 lines (63 loc) · 2 KB
/
setup
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env -S bash -e
if command -v neofetch &> /dev/null
then
neofetch
fi
# Colors
BOLDGREEN="\e[1;32m"
BOLDBLUE="\e[1;34m"
ITALICRED="\e[3;31m"
ENDCOLOR="\e[0m"
echo "Setting up enviroment"
echo ""
# -----------------------------------------
# Fetch git submodules and setup symlinks
# -----------------------------------------
# Installing submodules
echo "- Fetching git submodules"
git submodule update --init --recursive
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
function setup_link () {
SOURCE_FILE="$BASEDIR/$2"
DEST_FILE="$1"
# Ensure that the source file (or directory) exists before setting up a link
if ! [[ -f "$SOURCE_FILE" ]] && ! [[ -d "$SOURCE_FILE" ]]; then
printf " ${ITALICRED}✗ $SOURCE_FILE doesn't exist${ENDCOLOR}\n"
exit 1
fi
if [ -L ${DEST_FILE} ] ; then
if [ -e ${DEST_FILE} ] ; then
printf " ${BOLDGREEN}✓ Good link (${DEST_FILE})${ENDCOLOR}\n"
else
printf " ${ITALICRED}✗ Broken link (${DEST_FILE})${ENDCOLOR}\n"
fi
elif [ -e ${DEST_FILE} ] ; then
printf " ${ITALICRED}✗ Not a link (${DEST_FILE})${ENDCOLOR}\n"
else
mkdir -p "$(dirname "$DEST_FILE")"
ln -s $SOURCE_FILE $DEST_FILE
printf " ${BOLDBLUE}✓ Linked (${DEST_FILE})${ENDCOLOR}\n"
fi
}
echo "- Setting up symlinks"
setup_link "$HOME/.tmux.conf" "tmux.conf"
setup_link "$HOME/.vimrc" "vimrc"
setup_link "$HOME/.vim" "vim/"
setup_link "$HOME/.vim/autoload/plug.vim" "vim-plug/plug.vim"
setup_link "$HOME/.zshrc" "zshrc"
setup_link "$HOME/.ctags" "ctags"
setup_link "$HOME/.oh-my-zsh" "oh-my-zsh"
setup_link "$HOME/.gitconfig" "gitconfig"
setup_link "$HOME/.config/yabai/yabairc" "yabairc"
setup_link "$HOME/.config/skhd/skhdrc" "skhdrc"
setup_link "$HOME/.bin" "bin"
setup_link "$HOME/.config/nvim" "nvim"
# -----------------------------------------
# Vim setup
# -----------------------------------------
# Installing vim plugins
echo "- Installing vim plugins"
vim +PlugInstall! +qall
# Create backup and tmp folder for vim
mkdir -p ~/.vim/backup
mkdir -p ~/.vim/tmp