-
Notifications
You must be signed in to change notification settings - Fork 70
/
install-script.sh
executable file
·103 lines (92 loc) · 3.82 KB
/
install-script.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env bash
PWD=$(pwd)
# Make sure that if we happen to be running in cygwin the symlinks will get setup correctly.
# Make sure to enable develoepr more before installing
export CYGWIN="$CYGWIN winsymlinks:nativestrict"
if [[ -f "$PWD/dotVimRc" && ! -L "$PWD/dotVimRc" ]]; then
# first, backup any existing scripts if they are not symlinks
if [[ -d "$HOME/.vim" && ! -L "$HOME/.vim" ]]; then
echo -e "Moving ~/.vim to ~/.vim_backup"
mv ~/.vim ~/.vim_backup
else
echo "Not backing up $HOME/.vim - it has already been moved, is a symlink, or does not exist"
fi
# This is where neovim likes its config to be stored.
# Inside of our .vim directory, we already have a sym link from init.vim to
# .vimrc, so all we have to do is setup the directory for neovim.
mkdir -p "$HOME/.config"
if [[ -d "$HOME/.config/nvim" && ! -L "$HOME/.config/nvim" ]]; then
echo -e "Moving ~/.config/nvim to ~/.config/nvim_backup"
mv ~/.config/nvim ~/.config/nvim_backup
else
echo "Not backing up $HOME/.config/nvim - it has already been moved, is a symlink, or does not exist"
fi
# .vimrc is a file, use the -f flag
if [[ -f "$HOME/.vimrc" && ! -L "$HOME/.vimrc" ]]; then
echo -e "Moving $HOME/.vimrc to $HOME/.vimrc_backup"
mv ~/.vimrc ~/.vimrc_backup
else
echo "Not backing up $HOME/.vimrc - it has already been moved, is a symlink, or does not exist"
fi
# .gvimrc is a file, use the -f flag
if [[ -f "$HOME/.gvimrc" && ! -L "$HOME/.gvimrc" ]]; then
echo -e "Moving $HOME/.gvimrc to $HOME/.gvimrc_backup"
mv ~/.gvimrc ~/.gvimrc_backup
else
echo "Not backing up $HOME/.gvimrc - it has already been moved, is a symlink, or does not exist"
fi
# now we can link all the new VimBox to our home directory
if [[ ! -d "$HOME/.vim" && ! -L "$HOME/.vim" ]]; then
echo -e "Linking $HOME/.vim to $PWD/dotVim"
ln -s "$PWD/dotVim" ~/.vim
else
echo -e "Not linking from $HOME/.vim - it was already moved, or already existed"
fi
if [[ ! -d "$HOME/.config/nvim" && ! -L "$HOME/.config/nvim" ]]; then
echo -e "Linking $HOME/.config/nvim to $PWD/dotVim"
ln -s "$PWD/dotVim" "$HOME/.config/nvim"
else
echo -e "Not linking from $HOME/.config/nvim - it was already moved, or already existed"
fi
if [[ ! -f "$HOME/.vimrc" && ! -L "$HOME/.vimrc" ]]; then
echo -e "Linking $HOME/.vimrc to $PWD/dotVimRc"
ln -s "$PWD/dotVimRc" ~/.vimrc
else
echo -e "Not linking from $HOME/.vimrc - it was already moved, or already existed"
fi
if [[ ! -f "$HOME/.gvimrc" && ! -L "$HOME/.gvimrc" ]]; then
echo -e "Moving $PWD/dotGVimRc to ~/.gvimrc"
ln -s "$PWD/dotGVimRc" ~/.gvimrc
else
echo -e "Not linking from $HOME/.gvimrc - it was already moved, or already existed"
fi
if [ -d "$HOME/Library/Fonts" ]; then
FONT_SOURCE="$PWD/dotVim/Fonts/Iosevka/iosevka-regular.ttf"
FONT_DEST="$HOME/Library/Fonts/iosevka-regular.ttf"
if [[ ! -f "$FONT_DEST" ]]; then
echo -e "Installing font $FONT_SOURCE into $FONT_DEST"
cp "$FONT_SOURCE" "$FONT_DEST"
else
echo -e "The font $FONT_DEST was already installed"
fi
FONT_SOURCE="$PWD/dotVim/Fonts/Iosevka/iosevka-bold.ttf"
FONT_DEST="$HOME/Library/Fonts/iosevka-bold.ttf"
if [[ ! -f "$FONT_DEST" ]]; then
echo -e "Installing font $FONT_SOURCE into $FONT_DEST"
cp "$FONT_SOURCE" "$FONT_DEST"
else
echo -e "The font $FONT_DEST was already installed"
fi
FONT_SOURCE="$PWD/dotVim/Fonts/Iosevka/iosevka-italic.ttf"
FONT_DEST="$HOME/Library/Fonts/iosevka-italic.ttf"
if [[ ! -f "$FONT_DEST" ]]; then
echo -e "Installing font $FONT_SOURCE into $FONT_DEST"
cp "$FONT_SOURCE" "$FONT_DEST"
else
echo -e "The font $FONT_DEST was already installed"
fi
fi
else
echo -e "It seems you are not running the installer from within the VimBox root"
exit 1
fi