dotfiles/hosts/any/bashrc

39 lines
1.5 KiB
Bash
Raw Permalink Normal View History

# load powerline
if which powerline-daemon &>/dev/null; then
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
fi
2023-01-30 11:01:58 +00:00
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
2022-04-02 13:50:26 +00:00
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
2023-01-30 11:01:58 +00:00
elif [ -f /usr/share/powerline/bindings/bash/powerline.sh ] ; then
source /usr/share/powerline/bindings/bash/powerline.sh
fi