commit 81ba73f8170776a381eb2100440e397d38ea659f parent 993225cc9380118634821c4666b90534d4fca8a3 Author: Chris Bracken <chris@bracken.jp> Date: Sun, 29 Jun 2025 15:02:38 -0700 tmux: preserve pwd when splitting windows Overrides default " and % bindings to split but set the working directory of the new pane to the working directory of the pane being split. Does the same for the two default layouts mapped to ^ and \. Diffstat:
M | .config/tmux/tmux.conf | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf @@ -22,6 +22,11 @@ set-window-option -g automatic-rename off # Highlight panes with activity in the status bar. set-window-option -g monitor-activity on + +# Use current working directory when splitting windows. +bind-key '"' split-window -c "#{pane_current_path}" +bind-key '%' split-window -h -c "#{pane_current_path}" + # Movement key bindings. set-window-option -g mode-keys vi set-option -g status-keys vi @@ -40,8 +45,8 @@ bind-key -T copy-mode-vi 'r' send-keys -X rectangle-toggle bind-key b send-keys -R C-l\; clear-history # Frequently used layouts. -bind-key ^ split-window -h\; split-window -v\; select-pane -U\; select-pane -L -bind-key \\ split-window -h\; split-window -h\; select-layout even-horizontal\; select-pane -L +bind-key ^ split-window -h -c "#{pane_current_path}"\; split-window -v -c "#{pane_current_path}"\; select-pane -U\; select-pane -L +bind-key \\ split-window -h -c "#{pane_current_path}"\; split-window -h -c "#{pane_current_path}"\; select-layout even-horizontal\; select-pane -L # Solarized Osaka colour scheme. source ~/.config/tmux/solarized-osaka_moon.tmux