dotfiles/install

80 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
if [ -z "$HOME" ]; then echo "Seems you're \$HOMEless :("; exit 1; fi
DOTFILES=$HOME/.dotfiles
DOTFZF=$HOME/.fzf
DOTLOCAL=$HOME/.local/share/dotfiles
GITCLONE="git clone --depth=1"
cd "$HOME" || exit
rm -rf "$DOTFILES"
mkdir "$DOTFILES"
cd "$DOTFILES" || exit
git init
git remote add origin https://github.com/joshtronic/dotfiles.git
git pull origin master
# Swap origin so I can make edits easily
git remote rm origin
git remote add origin git@github.com:joshtronic/dotfiles.git
rm -rf \
"$DOTFZF" \
"$DOTLOCAL" \
"$HOME/.bashrc" \
"$HOME/.gitconfig" \
"$HOME/.config/gtk-3.0/gtk.css" \
"$HOME/.screenrc" \
"$HOME/.vim" \
"$HOME/.vimrc" \
"$HOME/.zshrc"
ln -s "$DOTFILES/bashrc" "$HOME/.bashrc"
ln -s "$DOTFILES/gitconfig" "$HOME/.gitconfig"
ln -s "$DOTFILES/gtk.css" "$HOME/.config/gtk-3.0/gtk.css"
ln -s "$DOTFILES/screenrc" "$HOME/.screenrc"
ln -s "$DOTFILES/vimrc" "$HOME/.vimrc"
ln -s "$DOTFILES/zshrc" "$HOME/.zshrc"
mkdir -p \
"$DOTLOCAL" \
"$HOME/.local/share/vim/{swap,undo}" \
"$HOME/.vim/pack/plugins/start"
$GITCLONE https://github.com/junegunn/fzf.git "$DOTFZF"
"${DOTFZF}/install" --key-bindings --completion --no-update-rc
ZSHPLUGS=(
"zsh-completions"
"zsh-history-substring-search"
"zsh-syntax-highlighting"
)
for INDEX in ${!ZSHPLUGS[*]}; do
ZSHPLUG="${ZSHPLUGS[$INDEX]}"
$GITCLONE "https://github.com/zsh-users/${ZSHPLUG}.git" "$DOTLOCAL/$ZSHPLUG"
done
VIMPLUGS=(
"w0rp/ale"
"junegunn/fzf.vim"
"sheerun/vim-polyglot"
"jelera/vim-javascript-syntax"
"Quramy/vim-js-pretty-template"
)
for INDEX in ${!VIMPLUGS[*]}; do
VIMPLUG="${VIMPLUGS[$INDEX]}"
PLUGDIR=$(echo "$VIMPLUG" | cut -d '/' -f2)
$GITCLONE "https://github.com/${VIMPLUG}.git" "$HOME/.vim/pack/plugins/start/$PLUGDIR"
done
cd "$HOME" || exit
rm -f "${HOME}/.zcompdump*"
echo
echo "DONEZO!!~!"