20 lines
841 B
Bash
20 lines
841 B
Bash
# Automatically rename new sessions to the basename of the current directory
|
|
# Only runs once at session creation
|
|
set-hook -g session-created 'run-shell "
|
|
base=$(basename \"#{pane_current_path}\")
|
|
if tmux has-session -t \"$base\" 2>/dev/null; then
|
|
i=2
|
|
while tmux has-session -t \"${base}-${i}\" 2>/dev/null; do
|
|
i=$((i+1))
|
|
done
|
|
tmux rename-session -t \"#{session_name}\" \"${base}-${i}\"
|
|
else
|
|
tmux rename-session -t \"#{session_name}\" \"$base\"
|
|
fi
|
|
"'
|
|
|
|
# Create a new Codex session from the current pane path and switch to it.
|
|
# Prefix + C prompts for the session name (default: "<current>-codex").
|
|
bind-key C command-prompt -p "Codex session name:" -I "#{session_name}-codex" \
|
|
"new-session -d -s '%%' -c '#{pane_current_path}' 'codex --dangerously-bypass-approvals-and-sandbox' \; switch-client -t '%%'"
|