Refactor _powerline_init_tmux_support
- Move _powerline_tmux* functions definitions out of _powerline_init_tmux_support. - Do not touch PROMPT_COMMAND unless tmux support is to be added.
This commit is contained in:
parent
d86064436d
commit
3d12662f8b
|
@ -10,11 +10,6 @@ _powerline_columns_fallback() {
|
|||
return 0
|
||||
}
|
||||
|
||||
_powerline_init_tmux_support() {
|
||||
if test -n "$TMUX" && tmux refresh -S &>/dev/null ; then
|
||||
# TMUX variable may be unset to create new tmux session inside this one
|
||||
_POWERLINE_TMUX="$TMUX"
|
||||
|
||||
_powerline_tmux_setenv() {
|
||||
TMUX="$_POWERLINE_TMUX" tmux setenv -g TMUX_"$1"_`tmux display -p "#D" | tr -d %` "$2"
|
||||
TMUX="$_POWERLINE_TMUX" tmux refresh -S
|
||||
|
@ -31,15 +26,17 @@ _powerline_init_tmux_support() {
|
|||
_powerline_tmux_setenv COLUMNS "${COLUMNS:-$(_powerline_columns_fallback)}"
|
||||
}
|
||||
|
||||
trap "_powerline_tmux_set_columns" SIGWINCH
|
||||
_powerline_init_tmux_support() {
|
||||
if test -n "$TMUX" && tmux refresh -S &>/dev/null ; then
|
||||
# TMUX variable may be unset to create new tmux session inside this one
|
||||
_POWERLINE_TMUX="$TMUX"
|
||||
|
||||
trap "_powerline_tmux_set_columns" WINCH
|
||||
_powerline_tmux_set_columns
|
||||
else
|
||||
_powerline_tmux_set_pwd() {
|
||||
return 0
|
||||
}
|
||||
fi
|
||||
|
||||
test "x$PROMPT_COMMAND" != "x${PROMPT_COMMAND/_powerline_tmux_set_pwd}" ||
|
||||
export PROMPT_COMMAND="${PROMPT_COMMAND}"$'\n_powerline_tmux_set_pwd'
|
||||
fi
|
||||
}
|
||||
|
||||
_powerline_prompt() {
|
||||
|
|
Loading…
Reference in New Issue