Skip to content

Instantly share code, notes, and snippets.

@uriel1998
Created August 23, 2025 19:58
Show Gist options
  • Save uriel1998/098a2b42469c28446ae3e09fcc98c8cb to your computer and use it in GitHub Desktop.
Save uriel1998/098a2b42469c28446ae3e09fcc98c8cb to your computer and use it in GitHub Desktop.
#!/bin/bash
# IN TMUX.CONF
# bind | if-shell -b '~/bin/tmux_split_same_dir' "send-keys ''"
# bind \\ if-shell -b '~/bin/tmux_split_same_dir -h' "send-keys ''"
# Get current pane's path
current_dir=$(tmux display-message -p -F "#{pane_current_path}")
# Split the window (horizontally or vertically)
# Use -h for horizontal split, omit for vertical
if [ "${1}" == "-h" ];then
tmux split-window -h -c "${current_dir}"
else
tmux split-window -c "${current_dir}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment