[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: from screen to tmux



davidson wrote:
> > 
> > I'm trying to switch from screen to tmux and for the life of me cannot
> > make it work the way I like. I have screen create multiple windows on
> > startup, by the following lines in ~/screenrc:
> > 
> > screen -t localhost 0
> > screen -t foo 1
> > screen -t bar 2
> > screen -t mail 3
> > select 0
> > 
> > I've tried multiple variants of ~/.tmux.conf and cannot make it start
> > with 4 windows. Tried different combinations of new-session, new-window,
> > attach-session, select-window and whatever, but when I run tmux, I just
> > see a single window.
> > 
> > What would be the equivalent of the above screen commands?
> 
> The first line below changes the command key from Ctrl-b to Ctrl-a, to
> emulate Gnu screen.
> 
>   $ cat ~/.tmux.conf
>   set-option -g prefix C-a

This is a nice feature, but not quite sufficient. You won't be able to
send a literal C-a to the terminal if you have just this one line.

I have 3 lines doing the same job:

set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix


>   new-session -nlocalhost -sMyFirstTmuxSession
>   new-window -d -nfoo -t1
>   new-window -d -nbar -t2
>   new-window -d -nmail -t3
> 
> I started my first session with this command:
> 
>   $ tmux attach

It is quite counter-intuitive to start a *first* session with "tmux attach", 
but your setup works, and thank you very much for that. I would have never
been able to think of such a variant.

> 
> And when I detach it, I can resume it again with the same command.
> 
> I based the config file above off the following example config, after
> some hunting around in the man page.
> 
>   $ tail -n12 /usr/share/doc/tmux/example_tmux.conf
>   # Create a single default session, because a session is created here, tmux
>   # should be started with "tmux attach" rather than "tmux new"

Well I never! 

I tried the new-window command in .tmux.conf, but it always created
windows somewhere below the event horizon.

Thank you again!

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

Attachment: signature.asc
Description: PGP signature


Reply to: