tilde <ti...@autistici.org> writes:
> I've tried somethink like that:
>
> new vim
> splitw -p 25 irssi
> splitw -h -p 50 mocp
> neww
> neww
> neww
>  
> select-window -t 1
>  
>
> but it seems to not work. Simply start with a single-window single-panel 
> session, with bash inside =\

In tmux 1.1, new-session (aka new) will terminate further command
processing.  See this thread for more on this:
http://thread.gmane.org/gmane.comp.terminal-emulators.tmux.user/124

One workaround in 1.1 is to do this:
    tmux new-session "tmux new-window \\; source $conf_file"

I.e., re-run tmux inside the new session to run your commands.

This restriction is gone in tmux HEAD in the repo.

The (zsh) shell function below is what I use to load various configs
like you seem to want.  Call it with the name of file containing the
tmux command sequence you wish to run, inside or outside of a tmux
session.

Uncomment the tmux new "tmux neww \\; ..." line if you're using 1.1

Cheers,
-Sudish

#!/bin/zsh

# Run various tmux commands from a standard location, starting a new
# tmux session if run outside one.
function tc() {
    local conf_dir="$HOME/.tmux_configs"

    if [[ $# = 0 || -z $1 ]]; then
        echo "Usage: $0 <configuration> [tmux new options]"
        return 1
    fi

    local conf_file="$conf_dir/$1"
    shift

    if [[ ! -r $conf_file ]]; then
        echo "No such configuration: $conf_file"
        return 1
    fi

    if [[ -z $TMUX ]] ; then
        # Pre tmux-1.2, Nicholas Marriott says: "new-session without
        # -d implies attach and that stops further command
        # processing."  So we source using a shell cmd inside tmux:
        # tmux new-session "tmux new-window \\; source $conf_file"
        #
        # new-session does the right thing in tmux-1.2 and later:
        tmux new-session "$@" \; source $conf_file
    else
        tmux source $conf_file
    fi
}

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to