Add bash prompt script for sourcing in bashrc

This only displays the left part of the prompt. It requires the
left-only theme to be able to display all segments.

The script must be sourced with an absolute path for now:

    . /path/to/powerline/bindings/bash/prompt.sh

Closes #90.
This commit is contained in:
Kim Silkebækken 2013-01-22 13:45:03 +01:00
parent 9035ec73f9
commit a023f4ad10
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
_powerline_prompt_command() {
export PS1="$(powerline-prompt --last_exit_code=$? left)"
_powerline_tmux_set_pwd
}
_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"
}
trap "_powerline_tmux_set_columns" SIGWINCH
kill -SIGWINCH "$$"
export PROMPT_COMMAND="_powerline_prompt_command"