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:
parent
9035ec73f9
commit
a023f4ad10
|
@ -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"
|
Loading…
Reference in New Issue