36 lines
1.4 KiB
Bash
36 lines
1.4 KiB
Bash
# load powerline
|
|
if which powerline-daemon &>/dev/null; then
|
|
powerline-daemon -q
|
|
POWERLINE_BASH_CONTINUATION=1
|
|
POWERLINE_BASH_SELECT=1
|
|
fi
|
|
|
|
PYVERSION=$(python3 --version | grep -Eo '[0-9]\.[0-9]')
|
|
if [ -f $HOME/.venv/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh ]; then
|
|
export VIRTUAL_ENV="$HOME/.venv"
|
|
export PATH=$VIRTUAL_ENV/bin:$PATH
|
|
# powerline-daemon -q
|
|
POWERLINE_BASH_CONTINUATION=1
|
|
POWERLINE_BASH_SELECT=1
|
|
|
|
function _update_ps1() {
|
|
if git log --oneline -n1 &>/dev/null ; then
|
|
REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | sed 's/.git$//'| head -1)
|
|
BRANCH=$(git branch --show-current)
|
|
tmux_title "$REPO($BRANCH)"
|
|
else
|
|
tmux_title "$(hostname)"
|
|
fi
|
|
PS1=$(powerline-shell $?)
|
|
}
|
|
|
|
if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
|
|
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
|
fi
|
|
|
|
# source $HOME/.venv/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh
|
|
elif [ -f ~/.local/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh ] ; then
|
|
source ~/.local/lib/python${PYVERSION}/site-packages/powerline/bindings/bash/powerline.sh
|
|
elif [ -f /usr/local/lib/python${PYVERSION}/dist-packages/powerline/bindings/bash/powerline.sh ]; then
|
|
source /usr/local/lib/python${PYVERSION}/dist-packages/powerline/bindings/bash/powerline.sh
|
|
fi
|