-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·71 lines (58 loc) · 2.15 KB
/
install
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
#!/bin/bash
set -euo pipefail; shopt -s failglob # safe mode
# XDG - set defaults as they may not be set (eg Ubuntu 14.04 LTS)
# See https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
# and https://wiki.archlinux.org/index.php/XDG_Base_Directory_support
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:=$HOME/.config}
export XDG_DATA_HOME=${XDG_DATA_HOME:=$HOME/.local/share}
export XDG_CACHE_HOME=${XDG_CACHE_HOME:=$HOME/.cache}
die() {
echo "$*: $?"
exit 1
}
function neobundle_update {
local VIMRC=$XDG_CONFIG_HOME/vim/load-plugins.vim
vim -N -u "$VIMRC" -c "try | NeoBundleUpdate! $* | finally | qall! | endtry" \
-U NONE -i NONE -e -s -V1 # -V1 prints X error messages
}
# Install stow (if not already installed)
distro=$(lsb_release -si)
case $distro in
*Ubuntu*)
dpkg -s stow &> /dev/null && sudo apt-get -y install stow ;;
esac
cd -P -- "$(dirname "$0")"
echo "Updating submodules... (eg vim. Wait - no output)"
git pull && git submodule update --init --recursive --recommend-shallow --depth 1
# --shallow-submodules not supported by Ubuntu
echo Submodule status:
git submodule status --recursive
# Stow packages
stow -v stow # Setup stow itself
# Install stow packages
./restow
echo "Stow of packages complete"
# Install fzf if not installed
if [[ ! -d "$XDG_DATA_HOME/fzf" ]]; then
git clone --single-branch --depth 1 'https://github.com/junegunn/fzf.git' "$XDG_DATA_HOME/fzf"
{ yes || true; } | "$XDG_DATA_HOME/fzf/install" --no-update-rc
mv -i ~/.fzf.{bash,zsh} "$XDG_DATA_HOME/fzf/"
else
echo "fzf already installed in $XDG_DATA_HOME/fzf"
fi
# Install neobundle to bootstrap vim plugin installation
# Dein is installed via load-plugins.vim
neobundle_dir="$XDG_DATA_HOME/vim/bundle/neobundle.vim"
if [[ ! -d $neobundle_dir ]]; then
git clone --single-branch --depth 1 --shallow-submodules https://github.com/Shougo/neobundle.vim.git "$neobundle_dir"
else
echo "NeoBundle already installed in $neobundle_dir"
fi
# vim plugins
echo "Installing vimproc for parallel vim plugin updates..."
neobundle_update vimproc
echo "Install/update all plugins..."
neobundle_update
echo
echo "Run ~/bin/local-update for YouCompleteMe and more"
echo