Change hook type

It makes sense to run _powerline_tmux_set_pwd only when working directory is 
changed.
This commit is contained in:
ZyX 2013-03-18 23:55:14 +04:00
parent e49d129cb2
commit 137ae5f990
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,5 @@
_powerline_tmux_setenv() { _powerline_tmux_setenv() {
emulate -L zsh
if [[ -n "$TMUX" ]]; then if [[ -n "$TMUX" ]]; then
tmux setenv TMUX_"$1"_$(tmux display -p "#D" | tr -d %) "$2" tmux setenv TMUX_"$1"_$(tmux display -p "#D" | tr -d %) "$2"
fi fi
@ -13,12 +14,13 @@ _powerline_tmux_set_columns() {
} }
_powerline_install_precmd() { _powerline_install_precmd() {
emulate -L zsh
for f in "${precmd_functions[@]}"; do for f in "${precmd_functions[@]}"; do
if [[ "$f" = "_powerline_precmd" ]]; then if [[ "$f" = "_powerline_precmd" ]]; then
return return
fi fi
done done
precmd_functions+=(_powerline_tmux_set_pwd) chpwd_functions+=( _powerline_tmux_set_pwd )
setopt promptpercent setopt promptpercent
setopt promptsubst setopt promptsubst
if zmodload zsh/zpython &>/dev/null ; then if zmodload zsh/zpython &>/dev/null ; then
@ -32,6 +34,6 @@ _powerline_install_precmd() {
} }
trap "_powerline_tmux_set_columns" SIGWINCH trap "_powerline_tmux_set_columns" SIGWINCH
kill -SIGWINCH $$ _powerline_tmux_set_columns
_powerline_install_precmd _powerline_install_precmd