Skip to content

Instantly share code, notes, and snippets.

@rdok
Last active September 24, 2017 15:30
Show Gist options
  • Save rdok/005b5dbcf057a9a9fe4d209290793ee9 to your computer and use it in GitHub Desktop.
Save rdok/005b5dbcf057a9a9fe4d209290793ee9 to your computer and use it in GitHub Desktop.
#!/bin/bash
#------------------------------------------------------------------------------
# Set up development machine. Vim, bashrc, and bash_aliases.
# Execute twice, if schema is missing.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Script configuration
#------------------------------------------------------------------------------
configUrl=https://git.io/vdTse
bashPrompt='PS1="\[\e[0;34m\]\u@\h:\[\e[0;33m\]\w\[\e[0;32m\]\$(__git_ps1)\n\'
bashPrompt+='[\e[0m\]\$ "'
setTabTitle='set-title(){ ORIG=$PS1; TITLE="\e]2;$@\a"; PS1=${ORIG}${TITLE}; }'
bashrcConfig=(
"$bashPrompt"
'export VISUAL=vim'
'export EDITOR="$VISUAL"'
"$setTabTitle"
)
bashAliasesConfig=(
'alias gs="git status"'
'alias gal="git add --all"'
'alias gcm="git commit -m"'
'alias pt="./vendor/bin/phpunit"'
'alias pa="php artisan"'
)
#------------------------------------------------------------------------------
# Install Vim runtime configuration settings.
#------------------------------------------------------------------------------
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
wget $configUrl -O ~/.vimrc
vim +PluginInstall +qall
#------------------------------------------------------------------------------
# Configurations Installation
#------------------------------------------------------------------------------
appendMissingConfigs() {
file=$1
configs=("${@:2}")
for config in "${configs[@]}"; do
if grep -Fxq "$config" $file; then continue; fi
echo "$config" >> $file
done
}
appendMissingConfigs ~/.bashrc "${bashrcConfig[@]}"
appendMissingConfigs ~/.bash_aliases "${bashAliasesConfig[@]}"
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment