Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a question similar to this guy http://stackoverflow.com/questions/5609192/how-to-set-up-tmux-so-that-it-starts-up-with-specified-windows-opened but more specific.

I want to do this in a single tmux.conf file, without any key-bindings to load specific sessions per @jasonwryan 's answer.

So, how do I do this? I set my tmux.conf:

new  -s mySession -n myWindow
neww -n foo/bar foo
splitw -v -p 50 -t 0 bar
selectw -t 1 
selectp -t 0

but it doesn't split the window when I start tmux.


Update: I don't think the attach is working. If I ditch the second 'foo' window and simplify my tmux.conf :

# set panes the way I want them
# if I started tmux by just running 'tmux' in command line, it automatically creates session(0) so...

new -s mySession -n myWindow    # ... create new session (1) with new window (0)
select-window -t myWindow       # select myWindow (0)
splitw -v -p 50 -t myWindow     # split myWindow (0) vertically into halves(50 percent)


attach -s mySession             # error usage: attach-session [-dr] [-t target-session]
attach-session -t mySession     # so this doesn't work either
switch -t mySession             # nor doesn't work

So what am I missing? If I manually switch sessions once tmux launches by doing CTRL+b s and then selecting the mySession, the panes are split and everything is great. So how do I attach to or switch to mySession from session(0)?

share|improve this question

migrated from stackoverflow.com Mar 14 '13 at 7:55

This question came from our site for professional and enthusiast programmers.

3  
Start tmux with tmux a... –  jasonwryan Mar 14 '13 at 1:13
    
this worked once I made the changes in my Update, but I should be able to do the "attach" INSIDE the tmux.conf, right? –  tir38 Apr 3 '13 at 21:44

1 Answer 1

After you've created the new session, create a new window, and split a window into 2 panes, you still need to attach to the session. Add

attach -s mySession

to the end of the commands you show above.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.