clean up vim packages and logic, make script safer to re-run

This commit is contained in:
2016-01-07 22:06:15 -07:00
parent 82bbb14862
commit 37e501e021

View File

@@ -1,18 +1,14 @@
#!/bin/bash #!/bin/bash
#configure vim bundles # configure vim bundles
VIM_BUNDLES=( VIM_BUNDLES=(
'git://github.com/vim-scripts/phpfolding.vim.git'
'git://github.com/msanders/snipmate.vim.git' 'git://github.com/msanders/snipmate.vim.git'
'git://github.com/scrooloose/syntastic.git' 'git://github.com/scrooloose/syntastic.git'
'git://github.com/kchmck/vim-coffee-script.git'
'git://github.com/altercation/vim-colors-solarized.git' 'git://github.com/altercation/vim-colors-solarized.git'
'git://github.com/digitaltoad/vim-jade.git'
'git://github.com/wavded/vim-stylus.git'
'git://github.com/tpope/vim-surround.git' 'git://github.com/tpope/vim-surround.git'
) )
#check for git # check for git
GIT=$(which git) GIT=$(which git)
if [ ! $? == 0 ]; then if [ ! $? == 0 ]; then
echo "You must install git and add it to you PATH" echo "You must install git and add it to you PATH"
@@ -20,30 +16,37 @@ if [ ! $? == 0 ]; then
fi fi
ROOT=`pwd` ROOT=`pwd`
# pre-run cleanup
rm -rf bash/bash_magic vim/bundle/* "${HOME}"/.vimrc
### ###
# bash # bash
### ###
#clone repo # clone bash_magic repo
$GIT clone git://github.com/Knewton/bash_magic.git bash/bash_magic if [ ! -d bash/bash_magic ]; then
$GIT clone git://github.com/w33ble/bash_magic.git bash/bash_magic
fi
#install select bash magic scripts # install select bash magic scripts
cd "bash/bash_magic" mkdir -p "${HOME}/bin" "${HOME}/.bash_aliases.d" "${HOME}/.bash_completion.d" "${HOME}/.bash_functions.d"
mkdir "${HOME}/bin" "${HOME}/.bash_aliases.d" "${HOME}/.bash_completion.d" "${HOME}/.bash_functions.d"
cd "bash_aliases.d"
cp color.sh refresh.sh "${HOME}/.bash_aliases.d"
cd "../bash_completion.d"
cp etc.sh "${HOME}/.bash_completion.d"
cd "../bash_functions.d"
cp completion.sh extract.sh lsbytes.sh lsnew.sh vim.sh "${HOME}/.bash_functions.d"
cd "${ROOT}"
#install custom bash scripts cd "${ROOT}/bash/bash_magic/bash_aliases.d";
cp "bash/bash_aliases.d/"*.sh "${HOME}/.bash_aliases.d" for i in color refresh; do cp "${i}.sh" "${HOME}/.bash_aliases.d"; done
#cp "bash/bash_completion.d/"*.sh "${HOME}/.bash_completion.d" cd "${ROOT}/bash/bash_magic/bash_completion.d";
#cp "bash/bash_functions.d/"*.sh "${HOME}/.bash_functions.d" for i in etc; do cp "${i}.sh" "${HOME}/.bash_completion.d"; done
#set up the bash_profile file cd "${ROOT}/bash/bash_magic/bash_functions.d";
cp bash/bash_profile "${HOME}"/.bash_profile for i in completion extract lsbytes lsnew vim; do cp "${i}.sh" "${HOME}/.bash_functions.d"; done
cat "bash/bash_magic/bashrc" >> "${HOME}"/.bash_profile
# install custom bash scripts
cp "${ROOT}/bash/bash_aliases.d/"*.sh "${HOME}/.bash_aliases.d"
# cp "${ROOT}/bash/bash_completion.d/"*.sh "${HOME}/.bash_completion.d"
# cp "${ROOT}/bash/bash_functions.d/"*.sh "${HOME}/.bash_functions.d"
# set up the bash_profile file
cp "${ROOT}/bash/bash_profile" "${HOME}"/.bash_profile
# add bash_magic logic to bash profile
cat "${ROOT}/bash/bash_magic/bashrc" >> "${HOME}"/.bash_profile
if [ ! -f "${HOME}"/.bashrc ]; then if [ ! -f "${HOME}"/.bashrc ]; then
ln -s "${HOME}"/.bash_profile "${HOME}"/.bashrc ln -s "${HOME}"/.bash_profile "${HOME}"/.bashrc
fi fi
@@ -51,7 +54,8 @@ fi
### ###
# dotfiles # dotfiles
### ###
cd dotfiles
cd "${ROOT}/dotfiles"
for i in *; do for i in *; do
cp "${i}" "${HOME}/.${i}" cp "${i}" "${HOME}/.${i}"
done done
@@ -60,25 +64,33 @@ cd "${ROOT}"
### ###
# git # git
### ###
# collect git user info, create config file
echo -n "Enter your git name: " echo -n "Enter your git name: "
read NAME read NAME
echo -n "Enter you git email: " echo -n "Enter you git email: "
read EMAIL read EMAIL
echo -e "[user]\n\tname = ${NAME}\n\temail = ${EMAIL}" > "${HOME}"/.gitconfig echo -e "[user]\n\tname = ${NAME}\n\temail = ${EMAIL}" > "${HOME}"/.gitconfig
cat git/gitconfig >> "${HOME}"/.gitconfig
cp git/githelpers "${HOME}"/.githelpers # add custom config and helpers
cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig
cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers
### ###
# vim # vim
### ###
#clone bundle repos
cd "vim/bundle" # clone bundle repos
echo "${ROOT}/vim/bundle"
cd "${ROOT}/vim/bundle"
pwd
for b in ${VIM_BUNDLES[@]}; do for b in ${VIM_BUNDLES[@]}; do
$GIT clone "${b}" $GIT clone "${b}"
done done
cd "${ROOT}" cd "${ROOT}"
#install # install
cp -R vim "${HOME}"/.vim cp -R vim "${HOME}"/.vim
ln -s "${HOME}"/.vim/vimrc "${HOME}"/.vimrc ln -s "${HOME}"/.vim/vimrc "${HOME}"/.vimrc