I just installed tmux on my new MacBook Pro, and am running into the following issue.
When I create a new window via the command tmux new-window
I get a new window with the same working directory as the session I'm creating from. This is the behavior I expect/desire.
When I create a new window using C-b C-c, I get a new window in my home directory.
Why are my shortcut keys giving me different behavior/how do I make them use the same directory?
Since Tmux 1.9 you should use the -c option in order to open a new working directory of the current pane.
tmux new-window -c '#{pane_current_path}'
Add this to your tmux.conf:
bind c new-window -c '#{pane_current_path}'
Note: It is also possible that you will have to exit all running instances of the TMUX server before any changes to the .tmux.conf
file will be loaded.
If you also want split windows in the current directory, you can add this to tmux.conf:
bind "\"" split-window -c '#{pane_current_path}'
bind "\%" split-window -h -c '#{pane_current_path}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With