Last active
August 29, 2015 14:21
-
-
Save mbenford/25b01027c6860ea8c5f7 to your computer and use it in GitHub Desktop.
My .bashrc file
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
alias la="ls -a" | |
alias psa="ps aux" |
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
GREEN="\[\e[0;32m\]" | |
RED="\[\e[0;31m\]" | |
LIGHTBLUE="\[\e[1;34m\]" | |
COLOREND="\[\e[00m\]" | |
git_branch_info() { | |
local branch_info=$(__git_ps1) | |
if [ ! "${branch_info}" == "" ]; then | |
if [ "$(git status --porcelain 2> /dev/null)" == "" ]; then | |
branch_info=${GREEN}${branch_info}${COLOREND} | |
else | |
branch_info=${RED}${branch_info}${COLOREND} | |
fi | |
local remote_branch=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2> /dev/null) | |
if [ ! "${remote_branch}" == "" ]; then | |
local ahead_count=$(git rev-list --count $remote_branch..HEAD) | |
if [ $ahead_count -gt 0 ]; then | |
branch_info=${branch_info/)/:${ahead_count})} | |
fi | |
fi | |
fi | |
echo $branch_info | |
} | |
prompt() { | |
local working_dir="${LIGHTBLUE}\w${COLOREND}" | |
local suffix="${LIGHTBLUE}\$${COLOREND} " | |
PS1="${working_dir}$(git_branch_info)${suffix}" | |
# Sets the terminal title as the current directory | |
printf "\e]2;${PWD/$HOME/\~}\a"; | |
} |
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
[[ -s "$HOME/.bash_aliases" ]] && source "$HOME/.bash_aliases" | |
[[ -s "$HOME/.bash_prompt" ]] && source "$HOME/.bash_prompt" | |
bind TAB:menu-complete | |
export PROMPT_COMMAND=prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment