Skip to content

Instantly share code, notes, and snippets.

@KruegerDesigns
Created June 25, 2024 21:56
Show Gist options
  • Save KruegerDesigns/37da0664c23fd20fead4fd2be8557a7c to your computer and use it in GitHub Desktop.
Save KruegerDesigns/37da0664c23fd20fead4fd2be8557a7c to your computer and use it in GitHub Desktop.
For 2024 MacOS Sonoma with Brew, Git, Bash, VSCode, Docker, and stuff...
# Setting PATH
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/bin"
# Homebrew
if command -v brew &>/dev/null; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Load .bashrc if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# Git Auto Completion
if [ -f /opt/homebrew/etc/bash_completion.d/git-completion.bash ]; then
. /opt/homebrew/etc/bash_completion.d/git-completion.bash
fi
if [ -f /opt/homebrew/etc/bash_completion ]; then
. /opt/homebrew/etc/bash_completion
fi
# Custom Prompt
export PS1="\u@\h \w\$ "
export BASH_SILENCE_DEPRECATION_WARNING=1
# Your custom settings
export PS1='\[\e[1;32m\]\u@\h \[\e[1;34m\]\w \$\[\e[0m\] '
alias ll='ls -la'
# VSCode command
alias vsc='code .'
alias vsc='subl .'
# Aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Docker Aliases
alias dstart='docker-compose up -d'
alias dstop='docker-compose down'
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
BOLD_BLUE='\033[1;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
RESET='\033[0m'
# Function to get the current Git branch and status
parse_git_branch() {
BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
if [ -n "$BRANCH" ]; then
STATUS=$(git status --porcelain 2>/dev/null)
if [ -z "$STATUS" ]; then
printf " ${GREEN}(${BRANCH} ✓)${RESET}"
else
printf " ${YELLOW}(${BRANCH} +)${RESET}"
fi
else
printf ""
fi
}
# Set the prompt to include the Git branch and status
export PS1="${BOLD_BLUE}\u${RESET}:${CYAN}\w\$(parse_git_branch)${RESET}\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment