homes/common/.local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh

29 lines
717 B
Bash
Raw Normal View History

2013-05-02 18:11:33 +02:00
_powerline_tmux_setenv() {
if [[ -n "$TMUX" ]]; then
tmux setenv TMUX_"$1"_$(tmux display -p "#D" | tr -d %) "$2"
fi
}
_powerline_tmux_set_pwd() {
_powerline_tmux_setenv PWD "$PWD"
}
_powerline_tmux_set_columns() {
_powerline_tmux_setenv COLUMNS "$COLUMNS"
}
_powerline_prompt() {
local last_exit_code=$?
[[ -z "$POWERLINE_OLD_PROMPT_COMMAND" ]] ||
eval $POWERLINE_OLD_PROMPT_COMMAND
PS1="$(powerline shell left -r bash_prompt --last_exit_code=$last_exit_code)"
_powerline_tmux_set_pwd
}
trap "_powerline_tmux_set_columns" SIGWINCH
_powerline_tmux_set_columns
[[ "$PROMPT_COMMAND" == "_powerline_prompt" ]] ||
POWERLINE_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
export PROMPT_COMMAND="_powerline_prompt"