gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.73k stars 3.34k forks source link

Question: when in session keep the pwd for all panes #670

Closed woss closed 6 months ago

woss commented 11 months ago

Hi,

I use tmux a lot and have around 3-5 sessions on normal use, almost all of them are part of one monorepo. What I would like to have is when I create a pane with Ctrl+a c, that pane keeps the path either the same as the previous pane or ( even better ) the root of the session.

Any help/discussion/tutorial/plugin/advice would be helpful :)

gpakosz commented 11 months ago

Hello @woss 👋

For the moment, you can edit your .local customization file and add the following

bind C-c new-session -c '#{pane_current_path}'

This breaks the tmux_conf_new_session_prompt feature though.

If you want to get the same behavior as when tmux_conf_new_session_prompt=true, use

bind C-c command-prompt -p new-session "new-session -s '%%' -c '#{pane_current_path}'"
woss commented 11 months ago

Hello @gpakosz,

thanks for the reply. I did what you suggested and it worked so I closed the issue.

gpakosz commented 11 months ago

That's fine. I'm keeping it open to maybe add a tmux_conf_new_session_retain_current_path option. Or make tmux_conf_new_session_prompt compatible with new-session overrides in .local files.

gpakosz commented 6 months ago

Hello @woss 👋

Can you please test the gh-670 branch?

woss commented 6 months ago

Hi, @gpakosz,

sure!!

Do i just need to switch the branch and test that with the already existing .tmux.conf creating new pane will create it in the same dir as the previous pane?

gpakosz commented 6 months ago

Do i just need to switch the branch and test that with the already existing .tmux.conf creating new pane will create it in the same dir as the previous pane?

Hmm, this was already possible with setting tmux_conf_new_pane_retain_current_path=true.

But you opened this issue specifically for sessions, so I introduced tmux_conf_new_session_retain_current_path which you need to set to true

woss commented 6 months ago

yup, I checked the commit you made in the branch, added the change with the true to my local config and it works!

amazing job! thank you so much