On Mon, Dec 10, 2012 at 05:13:43 GMT, Patricio Palladino wrote:
> Hi tmux community!
>
> I have been using tmux for the last year, and has became an essential
> tool for my development job, but I used to use panes almost
> exclusively until some months ago. I think automatic renaming is a
> great feature to remember which tab is which, and I couldn't live
> without it. But it gets somewhat useless when you have many windows
> with title "zsh", so I spent quite a long time trying to make a zsh
> hook to put the cwd instead of that, but didn't get the expected
> results (automatic renaming stopped working, or it ignored
> automatic-rename setting and change it always).

I use the following setup:

In .tmux.conf (ignoring colors):

    setw -g window-status-format '#I.#P#F:#T-#W'

At shell startup:

    tmux_title () {
        if [ -z "$TMUX" ]; then
            return 1
        fi

        if [ "$#" -eq 0 ]; then
            tmux display-message -p -t "$TMUX_PANE" -F "#{pane_title}"
        else
            local title

            title="$1"
            shift

            printf "\033]2;$title\033\\"
        fi
    }

    # Initialize to nothing iff it isn't already set.
    if [ "$( tmux_title )" = "$HOSTNAME" ]; then
        tmux_title ""
    fi

I then have a command "cdb" which uses "bookmarks" to change to a
project's directory, clear the directory stack, and to use the
tmux_title function to set the title on the pane.

By default windows in the status bar look like:

    1.0-:-irssi

and after using cdb it is:

    3.0-:uzbl-zsh

> So I decided to add this feature to tmux myself, and to my surprise it
> was really easy. tmux codebase is one of the cleanest C codes I've
> ever seen, indeed.

Agreed, I do love me clean C code (MPD is another example).

-- Ben


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to