Inconsistent new tmux window behavior

I just installed tmux on my new MacBook Pro, and I ran into the following problem.

When I create a new window using the tmux new-window command, I get a new window with the same working directory as the session I created. This is the behavior that I expect / desire.

When I create a new window using Cb Cc, I get a new window in my home directory.

Why do my keyboard shortcuts give me a different behavior / how do I get them to use the same directory?

+6
source share
3 answers

Since Tmux 1.9 you must use the -c option to open a new working directory for the current panel.

 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 need to exit all running instances of the TMUX server before any changes are loaded into the .tmux.conf file.

+15
source

If you also want to split the 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}' 
+9
source

Quotes should not be in tmux.conf ; at least not for tmux 2.1:

 # # open split panes in the current directory # bind-key \" split-window -c '#{pane_current_path}' bind-key \% split-window -h -c '#{pane_current_path}' 
-1
source

All Articles