tmux new pane has home directory as default instead of previous directory











up vote
17
down vote

favorite
3












When I press Ctrl+" (create a new pane) while in a pane, which has the PWD /tmp for example, the new pane starts as my home folder ~.



I looked at https://unix.stackexchange.com/a/109255/72471 and it helped me with the same issue concerning windows.



However, I couldn't fix the split-window issue by inserting



bind " split-window -c "#{pane_current_path}"


into my ~/.tmux.conf.



I am using tmux 1.9a and therefor don't want a rather messy solution for older versions stated here (it doesn't work in my case, anyway):



bind '"' set default-path "" ; split-window -v ; set -u default-path


How can I tell tmux to set the default directory as the current path of a pane, when creating a new pane?










share|improve this question




























    up vote
    17
    down vote

    favorite
    3












    When I press Ctrl+" (create a new pane) while in a pane, which has the PWD /tmp for example, the new pane starts as my home folder ~.



    I looked at https://unix.stackexchange.com/a/109255/72471 and it helped me with the same issue concerning windows.



    However, I couldn't fix the split-window issue by inserting



    bind " split-window -c "#{pane_current_path}"


    into my ~/.tmux.conf.



    I am using tmux 1.9a and therefor don't want a rather messy solution for older versions stated here (it doesn't work in my case, anyway):



    bind '"' set default-path "" ; split-window -v ; set -u default-path


    How can I tell tmux to set the default directory as the current path of a pane, when creating a new pane?










    share|improve this question


























      up vote
      17
      down vote

      favorite
      3









      up vote
      17
      down vote

      favorite
      3






      3





      When I press Ctrl+" (create a new pane) while in a pane, which has the PWD /tmp for example, the new pane starts as my home folder ~.



      I looked at https://unix.stackexchange.com/a/109255/72471 and it helped me with the same issue concerning windows.



      However, I couldn't fix the split-window issue by inserting



      bind " split-window -c "#{pane_current_path}"


      into my ~/.tmux.conf.



      I am using tmux 1.9a and therefor don't want a rather messy solution for older versions stated here (it doesn't work in my case, anyway):



      bind '"' set default-path "" ; split-window -v ; set -u default-path


      How can I tell tmux to set the default directory as the current path of a pane, when creating a new pane?










      share|improve this question















      When I press Ctrl+" (create a new pane) while in a pane, which has the PWD /tmp for example, the new pane starts as my home folder ~.



      I looked at https://unix.stackexchange.com/a/109255/72471 and it helped me with the same issue concerning windows.



      However, I couldn't fix the split-window issue by inserting



      bind " split-window -c "#{pane_current_path}"


      into my ~/.tmux.conf.



      I am using tmux 1.9a and therefor don't want a rather messy solution for older versions stated here (it doesn't work in my case, anyway):



      bind '"' set default-path "" ; split-window -v ; set -u default-path


      How can I tell tmux to set the default directory as the current path of a pane, when creating a new pane?







      tmux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:37









      Community

      1




      1










      asked Jul 27 '14 at 12:47









      polym

      6,51643157




      6,51643157






















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          39
          down vote



          accepted










          Try specifying v for vertical or h for horizontal



          My .tmux.conf file has:



          bind  split-window -h -c '#{pane_current_path}'  # Split panes horizontal
          bind - split-window -v -c '#{pane_current_path}' # Split panes vertically


          (I use and - as one-finger pane splitters.)



          New panes open for me using my current directory, wherever I am.

          It's certainly a key feature for me!



          One other critical thing with tmux (this was the issue in this case) is that you have to apply changes with:



          tmux source-file ~/.tmux.conf


          Note that closing terminals, even logging off and restarting, will NOT apply tmux changes – you have to actually use that command (or use Ctrl+B :source-file ~/.tmux.conf).



          You can see my full .tmux.conf file at https://github.com/durrantm/setups.






          share|improve this answer



















          • 2




            You said "Note that closing terminals, even logging off and restarting will NOT apply tmux changes". Of course if you only detached tmux it won't but killing and restarting the server will apply changes :).
            – soyuka
            Feb 11 '15 at 19:16








          • 2




            Thanks so much! This was super helpful. However, I'm pretty sure restarting the computer applies tmux changes :)
            – vitiral
            Oct 28 '15 at 16:52










          • Restarting the computer did not apply changes for me previously leading to confusion for me. ymmv
            – Michael Durrant
            Feb 18 '17 at 13:40










          • Note that the same thing can be done for new-window
            – math2001
            May 25 at 8:58


















          up vote
          18
          down vote













          bind '%' split-window -h -c '#{pane_current_path}'  # Split panes horizontal
          bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically
          bind c new-window -c '#{pane_current_path}' # Create new window


          Add last line to your ~/.tmux.conf to maintain $PWD in new window as well.






          share|improve this answer




























            up vote
            6
            down vote













            That's because,



            bind " split-window -c "#{pane_current_path}"


            should be



            bind '"' split-window -c "#{pane_current_path}"





            share|improve this answer




























              up vote
              0
              down vote













              In case someone gets here by searching, this works fine with tmux 2.7 and should be ok with likely all versions



              unbind '"'
              bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically

              unbind %
              bind % split-window -h -c '#{pane_current_path}' # Split panes horizontal





              share|improve this answer





















                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "106"
                };
                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',
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                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%2funix.stackexchange.com%2fquestions%2f146825%2ftmux-new-pane-has-home-directory-as-default-instead-of-previous-directory%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                39
                down vote



                accepted










                Try specifying v for vertical or h for horizontal



                My .tmux.conf file has:



                bind  split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                bind - split-window -v -c '#{pane_current_path}' # Split panes vertically


                (I use and - as one-finger pane splitters.)



                New panes open for me using my current directory, wherever I am.

                It's certainly a key feature for me!



                One other critical thing with tmux (this was the issue in this case) is that you have to apply changes with:



                tmux source-file ~/.tmux.conf


                Note that closing terminals, even logging off and restarting, will NOT apply tmux changes – you have to actually use that command (or use Ctrl+B :source-file ~/.tmux.conf).



                You can see my full .tmux.conf file at https://github.com/durrantm/setups.






                share|improve this answer



















                • 2




                  You said "Note that closing terminals, even logging off and restarting will NOT apply tmux changes". Of course if you only detached tmux it won't but killing and restarting the server will apply changes :).
                  – soyuka
                  Feb 11 '15 at 19:16








                • 2




                  Thanks so much! This was super helpful. However, I'm pretty sure restarting the computer applies tmux changes :)
                  – vitiral
                  Oct 28 '15 at 16:52










                • Restarting the computer did not apply changes for me previously leading to confusion for me. ymmv
                  – Michael Durrant
                  Feb 18 '17 at 13:40










                • Note that the same thing can be done for new-window
                  – math2001
                  May 25 at 8:58















                up vote
                39
                down vote



                accepted










                Try specifying v for vertical or h for horizontal



                My .tmux.conf file has:



                bind  split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                bind - split-window -v -c '#{pane_current_path}' # Split panes vertically


                (I use and - as one-finger pane splitters.)



                New panes open for me using my current directory, wherever I am.

                It's certainly a key feature for me!



                One other critical thing with tmux (this was the issue in this case) is that you have to apply changes with:



                tmux source-file ~/.tmux.conf


                Note that closing terminals, even logging off and restarting, will NOT apply tmux changes – you have to actually use that command (or use Ctrl+B :source-file ~/.tmux.conf).



                You can see my full .tmux.conf file at https://github.com/durrantm/setups.






                share|improve this answer



















                • 2




                  You said "Note that closing terminals, even logging off and restarting will NOT apply tmux changes". Of course if you only detached tmux it won't but killing and restarting the server will apply changes :).
                  – soyuka
                  Feb 11 '15 at 19:16








                • 2




                  Thanks so much! This was super helpful. However, I'm pretty sure restarting the computer applies tmux changes :)
                  – vitiral
                  Oct 28 '15 at 16:52










                • Restarting the computer did not apply changes for me previously leading to confusion for me. ymmv
                  – Michael Durrant
                  Feb 18 '17 at 13:40










                • Note that the same thing can be done for new-window
                  – math2001
                  May 25 at 8:58













                up vote
                39
                down vote



                accepted







                up vote
                39
                down vote



                accepted






                Try specifying v for vertical or h for horizontal



                My .tmux.conf file has:



                bind  split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                bind - split-window -v -c '#{pane_current_path}' # Split panes vertically


                (I use and - as one-finger pane splitters.)



                New panes open for me using my current directory, wherever I am.

                It's certainly a key feature for me!



                One other critical thing with tmux (this was the issue in this case) is that you have to apply changes with:



                tmux source-file ~/.tmux.conf


                Note that closing terminals, even logging off and restarting, will NOT apply tmux changes – you have to actually use that command (or use Ctrl+B :source-file ~/.tmux.conf).



                You can see my full .tmux.conf file at https://github.com/durrantm/setups.






                share|improve this answer














                Try specifying v for vertical or h for horizontal



                My .tmux.conf file has:



                bind  split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                bind - split-window -v -c '#{pane_current_path}' # Split panes vertically


                (I use and - as one-finger pane splitters.)



                New panes open for me using my current directory, wherever I am.

                It's certainly a key feature for me!



                One other critical thing with tmux (this was the issue in this case) is that you have to apply changes with:



                tmux source-file ~/.tmux.conf


                Note that closing terminals, even logging off and restarting, will NOT apply tmux changes – you have to actually use that command (or use Ctrl+B :source-file ~/.tmux.conf).



                You can see my full .tmux.conf file at https://github.com/durrantm/setups.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Feb 17 '17 at 20:37









                G-Man

                12.3k92961




                12.3k92961










                answered Jul 27 '14 at 12:52









                Michael Durrant

                15.6k44112180




                15.6k44112180








                • 2




                  You said "Note that closing terminals, even logging off and restarting will NOT apply tmux changes". Of course if you only detached tmux it won't but killing and restarting the server will apply changes :).
                  – soyuka
                  Feb 11 '15 at 19:16








                • 2




                  Thanks so much! This was super helpful. However, I'm pretty sure restarting the computer applies tmux changes :)
                  – vitiral
                  Oct 28 '15 at 16:52










                • Restarting the computer did not apply changes for me previously leading to confusion for me. ymmv
                  – Michael Durrant
                  Feb 18 '17 at 13:40










                • Note that the same thing can be done for new-window
                  – math2001
                  May 25 at 8:58














                • 2




                  You said "Note that closing terminals, even logging off and restarting will NOT apply tmux changes". Of course if you only detached tmux it won't but killing and restarting the server will apply changes :).
                  – soyuka
                  Feb 11 '15 at 19:16








                • 2




                  Thanks so much! This was super helpful. However, I'm pretty sure restarting the computer applies tmux changes :)
                  – vitiral
                  Oct 28 '15 at 16:52










                • Restarting the computer did not apply changes for me previously leading to confusion for me. ymmv
                  – Michael Durrant
                  Feb 18 '17 at 13:40










                • Note that the same thing can be done for new-window
                  – math2001
                  May 25 at 8:58








                2




                2




                You said "Note that closing terminals, even logging off and restarting will NOT apply tmux changes". Of course if you only detached tmux it won't but killing and restarting the server will apply changes :).
                – soyuka
                Feb 11 '15 at 19:16






                You said "Note that closing terminals, even logging off and restarting will NOT apply tmux changes". Of course if you only detached tmux it won't but killing and restarting the server will apply changes :).
                – soyuka
                Feb 11 '15 at 19:16






                2




                2




                Thanks so much! This was super helpful. However, I'm pretty sure restarting the computer applies tmux changes :)
                – vitiral
                Oct 28 '15 at 16:52




                Thanks so much! This was super helpful. However, I'm pretty sure restarting the computer applies tmux changes :)
                – vitiral
                Oct 28 '15 at 16:52












                Restarting the computer did not apply changes for me previously leading to confusion for me. ymmv
                – Michael Durrant
                Feb 18 '17 at 13:40




                Restarting the computer did not apply changes for me previously leading to confusion for me. ymmv
                – Michael Durrant
                Feb 18 '17 at 13:40












                Note that the same thing can be done for new-window
                – math2001
                May 25 at 8:58




                Note that the same thing can be done for new-window
                – math2001
                May 25 at 8:58












                up vote
                18
                down vote













                bind '%' split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically
                bind c new-window -c '#{pane_current_path}' # Create new window


                Add last line to your ~/.tmux.conf to maintain $PWD in new window as well.






                share|improve this answer

























                  up vote
                  18
                  down vote













                  bind '%' split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                  bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically
                  bind c new-window -c '#{pane_current_path}' # Create new window


                  Add last line to your ~/.tmux.conf to maintain $PWD in new window as well.






                  share|improve this answer























                    up vote
                    18
                    down vote










                    up vote
                    18
                    down vote









                    bind '%' split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                    bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically
                    bind c new-window -c '#{pane_current_path}' # Create new window


                    Add last line to your ~/.tmux.conf to maintain $PWD in new window as well.






                    share|improve this answer












                    bind '%' split-window -h -c '#{pane_current_path}'  # Split panes horizontal
                    bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically
                    bind c new-window -c '#{pane_current_path}' # Create new window


                    Add last line to your ~/.tmux.conf to maintain $PWD in new window as well.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 4 '15 at 21:44









                    Shubham

                    18914




                    18914






















                        up vote
                        6
                        down vote













                        That's because,



                        bind " split-window -c "#{pane_current_path}"


                        should be



                        bind '"' split-window -c "#{pane_current_path}"





                        share|improve this answer

























                          up vote
                          6
                          down vote













                          That's because,



                          bind " split-window -c "#{pane_current_path}"


                          should be



                          bind '"' split-window -c "#{pane_current_path}"





                          share|improve this answer























                            up vote
                            6
                            down vote










                            up vote
                            6
                            down vote









                            That's because,



                            bind " split-window -c "#{pane_current_path}"


                            should be



                            bind '"' split-window -c "#{pane_current_path}"





                            share|improve this answer












                            That's because,



                            bind " split-window -c "#{pane_current_path}"


                            should be



                            bind '"' split-window -c "#{pane_current_path}"






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Feb 19 '15 at 5:02









                            Giumo

                            7315




                            7315






















                                up vote
                                0
                                down vote













                                In case someone gets here by searching, this works fine with tmux 2.7 and should be ok with likely all versions



                                unbind '"'
                                bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically

                                unbind %
                                bind % split-window -h -c '#{pane_current_path}' # Split panes horizontal





                                share|improve this answer

























                                  up vote
                                  0
                                  down vote













                                  In case someone gets here by searching, this works fine with tmux 2.7 and should be ok with likely all versions



                                  unbind '"'
                                  bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically

                                  unbind %
                                  bind % split-window -h -c '#{pane_current_path}' # Split panes horizontal





                                  share|improve this answer























                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    In case someone gets here by searching, this works fine with tmux 2.7 and should be ok with likely all versions



                                    unbind '"'
                                    bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically

                                    unbind %
                                    bind % split-window -h -c '#{pane_current_path}' # Split panes horizontal





                                    share|improve this answer












                                    In case someone gets here by searching, this works fine with tmux 2.7 and should be ok with likely all versions



                                    unbind '"'
                                    bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically

                                    unbind %
                                    bind % split-window -h -c '#{pane_current_path}' # Split panes horizontal






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 26 at 13:46









                                    ShahinSorkh

                                    11




                                    11






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                        • 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.





                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                        Please pay close attention to the following guidance:


                                        • 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%2funix.stackexchange.com%2fquestions%2f146825%2ftmux-new-pane-has-home-directory-as-default-instead-of-previous-directory%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

                                        Morgemoulin

                                        Scott Moir

                                        Souastre