Last active
July 12, 2019 12:58
-
-
Save kykosic/d44520e227177079d82b404c2a52b7ad to your computer and use it in GitHub Desktop.
This file contains 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
# Git branch labeling | |
find_git_branch() { | |
local branch | |
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then | |
if [[ "$branch" == "HEAD" ]]; then | |
branch='detached*' | |
fi | |
git_branch="($branch)" | |
else | |
git_branch="" | |
fi | |
} | |
find_git_dirty() { | |
local status=$(git status --porcelain 2> /dev/null) | |
if [[ "$status" != "" ]]; then | |
git_dirty='*' | |
else | |
git_dirty='' | |
fi | |
} | |
get_battery_perc() { | |
battery_perc=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) | |
} | |
PROMPT_COMMAND="find_git_branch; find_git_dirty; get_battery_perc; $PROMPT_COMMAND" | |
# Format prompt | |
export PS1="\[\033[1;32m\]\$battery_perc% \A \[\033[1;34m\]\w \[\033[0;36m\]\$git_branch\[\033[0;31m\]\$git_dirty\[\033[0m\]$ " | |
# ls colors | |
export LSCOLORS=Exfxcxdxbxexexabagacad | |
alias ls='ls -G' | |
alias vi="vim" | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
# Bash completion | |
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" | |
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" | |
# Aliases | |
alias ecr-login='eval $\(aws ecr get-login --no-include-email --region us-east-1 \)' | |
alias vi=nvim | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment