tmux new pane has home directory as default instead of previous directory
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.
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.
That's because,
bind " split-window -c "#{pane_current_path}"
should be
bind '"' split-window -c "#{pane_current_path}"