tmux で cdd (別の WINDOW のカレントに移動)する

cdd - screen の別WINDOWのカレントディレクトリに移動する zsh スクリプト - 川o・-・)<2nd life
上記を tmux で行いたかったので cdd に二行ほど加えてみました。

diff cdd.org cdd.new

44a45
> export WINDOW=`tmux respawn-window | cut -d ':' -f 3`
47c48
<   if [ "$STY" != "" ]; then
---
>   if [ "$STY" != "" ] || [ "$TMUX" != "" ] ; then

http://github.com/cooldaemon/myhome/blob/master/bin/cdd

.zshrc の中で screen 用にゴニョゴニョ行ってる箇所は、これで全て tmux で動作するようになりました。
具体的には、下記のあたり。
http://github.com/cooldaemon/myhome/blob/master/.zsh/screen.zsh
http://github.com/cooldaemon/myhome/blob/master/.zsh/prompt.zsh

automatic-rename で screen.zsh は不要かもなぁ
export WINDOW の行は、$TMUX が存在する場合にのみ実行するよう修正する必要がある

if [ "$TMUX" != "" ] ; then
  export WINDOW=`tmux respawn-window | cut -d ':' -f 3`
fi

tmux を 1.3 にバージョンアップしたら `tmux respawn-window` の結果が stderr に出るようになりました。環境変数 WINDOW に入れる値は、下記のコマンドで取得できます。

tmux respawn-window 2>&1 > /dev/null | cut -d ':' -f 3