2013-08-08 03:23:13 +00:00
|
|
|
# Set file as having been loaded to avoid looping
|
|
|
|
IS_BASH_PROFILE_LOADED=true
|
|
|
|
# If bashrc hasn't been loaded, load it
|
|
|
|
if [ -z "$IS_BASHRC_LOADED" ] ; then
|
2019-11-14 01:23:15 +00:00
|
|
|
# shellcheck source=bashrc
|
|
|
|
source "$HOME/.bashrc"
|
2013-08-08 03:23:13 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Some stuff is OS Dependent
|
|
|
|
DET_OS="unknown"
|
2019-11-14 01:23:15 +00:00
|
|
|
UNAME_STR=$(uname)
|
2013-08-08 03:23:13 +00:00
|
|
|
|
|
|
|
if [[ "$UNAME_STR" == "Darwin" ]]; then
|
|
|
|
DET_OS="mac"
|
|
|
|
elif [[ "$UNAME_STR" == "Linux" ]]; then
|
|
|
|
DET_OS="linux"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Since this is a mac, source the bashrc
|
|
|
|
if [[ "$DET_OS" == "mac" ]]; then
|
|
|
|
# Bash Completion
|
|
|
|
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
|
2019-11-14 01:23:15 +00:00
|
|
|
source /opt/local/etc/profile.d/bash_completion.sh
|
2013-08-08 03:23:13 +00:00
|
|
|
fi
|
|
|
|
if [ -f /opt/local/share/bash-completion/completions/git-flow ]; then
|
2019-11-14 01:23:15 +00:00
|
|
|
source /opt/local/share/bash-completion/completions/git-flow
|
2013-08-08 03:23:13 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-03-26 06:04:24 +00:00
|
|
|
# Set prompt to include some useful information
|
|
|
|
function ps_git_branch {
|
2013-08-08 03:23:13 +00:00
|
|
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
2019-11-14 01:23:15 +00:00
|
|
|
echo " (${ref#refs/heads/})"
|
2013-08-08 03:23:13 +00:00
|
|
|
}
|
|
|
|
|
2015-03-26 06:04:24 +00:00
|
|
|
function ps_atf_target {
|
2013-08-08 03:23:13 +00:00
|
|
|
org=$(atf-target 2> /dev/null) || return
|
|
|
|
echo " [$org]"
|
|
|
|
}
|
|
|
|
|
2015-03-26 06:04:24 +00:00
|
|
|
function ps_force_target {
|
2019-11-14 01:23:15 +00:00
|
|
|
test "true" = "$( git config force.use 2> /dev/null )" || return
|
2013-08-08 03:23:13 +00:00
|
|
|
org=$(force-target 2> /dev/null) || return
|
|
|
|
echo " [$org]"
|
|
|
|
}
|
|
|
|
|
2015-03-26 06:04:24 +00:00
|
|
|
function ps_host_name {
|
2019-11-14 01:23:15 +00:00
|
|
|
[ -z "$TMUX" ] || return && echo '\h '
|
2015-03-26 06:04:24 +00:00
|
|
|
}
|
|
|
|
|
2015-04-08 18:33:21 +00:00
|
|
|
function ps_virtual_env {
|
|
|
|
[ -z "$VIRTUAL_ENV" ] && return
|
|
|
|
venv=$(basename "$VIRTUAL_ENV") || return
|
|
|
|
echo " [$venv]"
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:12:04 +00:00
|
|
|
# Disable standard virtualenv prompt
|
|
|
|
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
|
|
|
|
2013-08-08 03:23:13 +00:00
|
|
|
# Alias for colors
|
2019-11-14 01:23:15 +00:00
|
|
|
# RED="\[\033[0;31m\]"
|
2013-08-08 03:23:13 +00:00
|
|
|
YELLOW="\[\033[0;33m\]"
|
|
|
|
GREEN="\[\033[0;32m\]"
|
|
|
|
ENDCOLOR="\[\e[0m\]"
|
|
|
|
|
|
|
|
# New prompt format
|
2015-04-08 18:33:21 +00:00
|
|
|
PS1="$(ps_host_name)\W$YELLOW\$(ps_git_branch)$ENDCOLOR$GREEN\$(ps_atf_target)\$(ps_force_target)\$(ps_virtual_env)$ENDCOLOR\$ "
|
2013-08-08 03:23:13 +00:00
|
|
|
|
|
|
|
# Prompt Title
|
|
|
|
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'
|
|
|
|
|
|
|
|
# Set cursor colors
|
|
|
|
export CLICOLOR=1
|
|
|
|
export LSCOLORS=ExFxCxDxBxegedabagacad
|
|
|
|
|
2017-04-21 20:20:23 +00:00
|
|
|
# Vim colors
|
2019-11-14 01:23:15 +00:00
|
|
|
[ -n "$VIM_COLOR" ] || export VIM_COLOR="$(eval "$HOME/bin/get_vim_colorscheme.sh")" || export VIM_COLOR='wombat256mod'
|
2017-04-21 20:20:23 +00:00
|
|
|
|
2020-02-20 22:12:29 +00:00
|
|
|
if type rg &> /dev/null; then
|
|
|
|
export FZF_DEFAULT_COMMAND='rg --files'
|
|
|
|
# export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden'
|
|
|
|
elif type ag &> /dev/null; then
|
|
|
|
export FZF_DEFAULT_COMMAND='ag -g ""'
|
|
|
|
fi
|
|
|
|
if [ -n "$FZF_DEFAULT_COMMAND" ]; then
|
|
|
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND \$dir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# vim: set filetype=sh:
|