Skip to content

Instantly share code, notes, and snippets.

@xkrsz
Created July 26, 2017 10:01
Show Gist options
  • Save xkrsz/0bd8408891eabe62dbd0e435aac67fa1 to your computer and use it in GitHub Desktop.
Save xkrsz/0bd8408891eabe62dbd0e435aac67fa1 to your computer and use it in GitHub Desktop.
Mac setup
#!/bin/bash
echo "Hello, $USER"
function gitPrompt {
echo -n "Do you want to configure git? [y/n]: "
read configure_git
if [ "$configure_git" == "y" ] || [ "$configure_git" == "Y" ]; then
configure_git=true
getGitConfig
elif [ "$configure_git" == "n" ] || [ "$configure_git" == "N" ]; then
configure_git=false
else
echo "Bad answer, try again."
sleep .2
gitPrompt
fi
}
function getGitConfig {
echo -n "What's your email?: "
read email
if [ $email == "" ]; then
echo "Email can't be empty, try again."
sleep .2
configureGit
fi
echo -n "What's your name?: "
read name
if [[ ! -z "${param// }" ]]; then
echo "Name can't be empty, try again."
sleep .2
configureGit
fi
}
function configureGit {
git config --global user.name "$name"
git config --global user.email $email
echo "Git has been configured."
}
gitPrompt
# Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || exit 1
# zsh
brew install zsh zsh-completions wget git || exit 1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
rm ~/.zshrc ||:
wget -O ~/.zshrc https://raw.githubusercontent.com/krszwsk/dotfiles/master/mac/.zshrc
# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# zsh-autosuggestions
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# fonts
mkdir tmp ||:
cd tmp
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
cd ..
rm -rf fonts
if [ $configure_git == true ]; then
configureGit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment