Last active
November 19, 2018 20:41
-
-
Save eser/a4872d98f21bfad60e05fdc5cebefb6d to your computer and use it in GitHub Desktop.
.bash_profile
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
# colors | |
CHAR_ARROW="\xEE\x82\xB0" # "" | |
COLOR_RESET="\033[m" | |
COLOR_WHITE_ON_BLACK="\033[38;5;15m\033[48;5;0m" | |
COLOR_BLACK_ON_TRANSPARENT="\033[38;5;0m\033[49m" | |
COLOR_BLACK_ON_GRAY="\033[38;5;0m\033[48;5;237m" | |
COLOR_WHITE_ON_GRAY="\033[38;5;15m\033[48;5;237m" | |
COLOR_GRAY_ON_TRANSPARENT="\033[38;5;237m\033[49m" | |
COLOR_BLACK_ON_CRIMSON="\033[38;5;0m\033[48;5;88m" | |
COLOR_WHITE_ON_CRIMSON="\033[38;5;15m\033[48;5;88m" | |
COLOR_CRIMSON_ON_TRANSPARENT="\033[38;5;88m\033[49m" | |
COLOR_BLACK_ON_MAGENTA="\033[38;5;0m\033[48;5;89m" | |
COLOR_WHITE_ON_MAGENTA="\033[38;5;15m\033[48;5;89m" | |
COLOR_MAGENTA_ON_TRANSPARENT="\033[38;5;89m\033[49m" | |
# prompt | |
function custom_prompt { | |
local prompt_text="" | |
local git_enabled="1" | |
if [[ $git_enabled == "1" ]]; then | |
# branch color | |
local git_status="`git status 2> /dev/null`" | |
if [[ $git_status == "" ]]; then | |
local next_arrow_color=$COLOR_BLACK_ON_TRANSPARENT | |
local git_directory="0" | |
elif [[ ! $git_status =~ "nothing to commit, working tree clean" ]]; then | |
prompt_text+="$COLOR_BLACK_ON_CRIMSON$CHAR_ARROW$COLOR_WHITE_ON_CRIMSON" | |
local next_arrow_color=$COLOR_CRIMSON_ON_TRANSPARENT | |
local git_directory="1" | |
else | |
prompt_text+="$COLOR_BLACK_ON_GRAY$CHAR_ARROW$COLOR_WHITE_ON_GRAY" | |
local next_arrow_color=$COLOR_GRAY_ON_TRANSPARENT | |
local git_directory="1" | |
fi | |
# branch info | |
local git_status="`git status 2> /dev/null`" | |
local on_branch="On branch ([^${IFS}]*)" | |
local on_commit="HEAD detached at ([^${IFS}]*)" | |
if [[ $git_directory == "1" ]]; then | |
if [[ $git_status =~ $on_branch ]]; then | |
local branch=${BASH_REMATCH[1]} | |
prompt_text+=" $branch " | |
elif [[ $git_status =~ $on_commit ]]; then | |
local commit=${BASH_REMATCH[1]} | |
prompt_text+=" $commit " | |
fi | |
fi | |
prompt_text+="" | |
else | |
local next_arrow_color=$COLOR_BLACK_ON_TRANSPARENT | |
fi | |
prompt_text+="$next_arrow_color$CHAR_ARROW $COLOR_RESET" | |
echo -e $prompt_text | |
} | |
export PS1="\[$COLOR_WHITE_ON_BLACK\] \w \$(custom_prompt)\033[m" | |
export GREP_OPTIONS='--color=auto' | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
# ls | |
# alias ls='ls -FGh' | |
# alias ll='ls -l' | |
alias ls='exa' | |
alias ll='exa -l --color=always --header --git --time-style=long-iso' | |
# git | |
git config --global color.ui true | |
# aria | |
# alias aria='aria2c --enable-rpc=true --rpc-allow-origin-all=true --rpc-listen-all=true' | |
# nvm | |
export NVM_DIR="$HOME/.nvm" | |
. "/usr/local/opt/nvm/nvm.sh" | |
# paths | |
export PATH="$PATH:/usr/local/sbin:/usr/local/opt/libpq/bin:~/.sonar" | |
# bash completion | |
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion | |
[ -f /usr/local/etc/bash_completion.d/git-prompt.sh ] && . /usr/local/etc/bash_completion.d/git-prompt.sh | |
[ -f /usr/local/etc/bash_completion.d/git-completion.bash ] && . /usr/local/etc/bash_completion.d/git-completion.bash | |
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh | |
# iterm2 | |
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment