automatically split windows at tmux startup












2















I have a question similar to this guy https://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
















2















I have a question similar to this guy https://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














2












2








2








I have a question similar to this guy https://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
















I have a question similar to this guy https://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)?







tmux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 12:41









Community

1




1










asked Mar 13 '13 at 20:27









tir38tir38

8312811




8312811




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


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






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














  • 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








3




3





Start tmux with tmux a...

– jasonwryan
Mar 14 '13 at 1:13





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





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






active

oldest

votes


















0














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








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f565716%2fautomatically-split-windows-at-tmux-startup%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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




























      0














      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


























        0












        0








        0







        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













        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












        share|improve this answer



        share|improve this answer










        answered Mar 15 '13 at 18:03









        chepnerchepner

        4,8451324




        4,8451324






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f565716%2fautomatically-split-windows-at-tmux-startup%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido