Tmux – Make Sessions Count from 1 Instead of 0

tmux

I have this setting:

# Number windows and panes starting at 1 so that we can jump to
# them easier.
set -g base-index 1
set -g pane-base-index 1

But I'd also like to have the same for switching tmux sessions. When I open the tmux session list it still starts on 0. Is it possible to not start session counting from 0 but from 1 instead?

tmux session list

Best Answer

You appear to be referring to the session group index, which is generated, and not used for telling tmux which session you would like to attach to.

It's used in the template for list-sessions:

"#{?session_grouped, (group ,}" \

and generated in session.c (and always starts at zero):

/* Find session group index. */
u_int
session_group_index(struct session_group *sg)
{
    struct session_group   *sg2;
    u_int           i;

    i = 0;
    TAILQ_FOREACH(sg2, &session_groups, entry) {
        if (sg == sg2)
            return (i);
        i++;
    }

    fatalx("session group not found");
}

but that value is used only in formatted output.

Related Question