Last active
September 24, 2017 15:30
-
-
Save rdok/005b5dbcf057a9a9fe4d209290793ee9 to your computer and use it in GitHub Desktop.
wget -O - https://gist.github.com/rdok/005b5dbcf057a9a9fe4d209290793ee9/raw/949b34fb389bfd41c7e1fab96460fd32cf6615e2/setup_dev.sh | bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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