#!/bin/bash
BASE="/etc/vim"
BASESTART="/etc/vim/pack/vendor/start"
BASEOPT="/etc/vim/pack/vendor/opt"

if [ ! -d "$BASESTART" ] ;
then
	mkdir -p $BASESTART
fi

if [ ! -d "$BASEOPT" ] ;
then
	mkdir -p $BASEOPT
fi

cd $BASESTART || exit
if [ ! -d "$BASESTART/lightline.vim" ] ;
then
	git clone https://github.com/itchyny/lightline.vim
else
	cd $BASESTART/lightline.vim || exit
	git pull
fi

cd $BASESTART || exit
if [ ! -d "$BASESTART/vim-mucomplete" ] ;
then
	git clone https://github.com/lifepillar/vim-mucomplete.git
else
	cd $BASESTART/vim-mucomplete || exit
	git pull
fi

cd $BASESTART || exit
if [ ! -d "$BASESTART/ale" ] ;
then
	git clone https://github.com/dense-analysis/ale.git
else
	cd $BASESTART/ale || exit
	git pull
fi

cd $BASESTART || exit
if [ ! -d "$BASESTART/nginx.vim" ] ;
then
	git clone https://github.com/chr4/nginx.vim.git
else
	cd $BASESTART/nginx.vim || exit
	git pull
fi

#opt
cd $BASEOPT || exit
if [ ! -d "$BASEOPT/vim-autoclose" ] ;
then
	git clone https://github.com/Townk/vim-autoclose.git
else
	cd $BASEOPT/vim-autoclose || exit
	git pull
fi

cd $BASEOPT || exit
if [ ! -d "$BASEOPT/onedark.vim" ] ;
then
	git clone https://github.com/joshdick/onedark.vim.git
else
	cd $BASEOPT/onedark.vim || exit
	git pull
fi

cd $BASEOPT || exit
if [ ! -d "$BASEOPT/AutoComplPop" ] ;
then
	git clone https://github.com/vim-scripts/AutoComplPop.git
else
	cd $BASEOPT/AutoComplPop || exit
	git pull
fi

cd $BASE || exit
wget https://download.al1al7.de/vim/vimrc.local -O $BASE/vimrc.local

