mirror of
1
0
Fork 0

introduced tmux_conf_new_session_retain_current_path, resolves #670

This commit is contained in:
Gregory Pakosz 2024-02-09 10:13:28 +01:00
parent 48d4cec23e
commit b892bc155b
2 changed files with 24 additions and 7 deletions

View File

@ -889,14 +889,14 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# perl -p -i -e "
# s/\bnew-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/
# ;
# s/\bnew-window\b/new-window -c '#{pane_current_path}'\1/g
# s/\bnew-window\b/new-window -c '#{pane_current_path}'/g
# ;
# s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_new_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _new_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\3'/g if /\bdisplay-menu\b/
# ;
# s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_new_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _new_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \"#\{pane_current_path\}\"\3'/g" \
# "$cfg"
# fi
#
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
# if ! _is_disabled "$tmux_conf_new_pane_retain_current_path"; then
# perl -p -i -e "
@ -931,13 +931,24 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
#
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
# if ! _is_disabled "$tmux_conf_new_session_prompt" && _is_true "$tmux_conf_new_session_prompt"; then
# perl -p -i \
# -e "s/(?<!command-prompt -p )\b(new-session)\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/" \
# -e ';' \
# -e "s/(?<!\bcommand-prompt -p )\bnew-session\b(?! -s)/command-prompt -p new-session 'new-session -s \"%%\"'/g" \
# perl -p -i -e "
# s/(?<!command-prompt -p )\b(new-session)\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/
# ;
# s/(?<!\bcommand-prompt -p )\bnew-session\b(?! -s)/command-prompt -p new-session \"new-session -s '%%'\"/g" \
# "$cfg"
# else
# perl -p -i -e "s/\bcommand-prompt\s+-p\s+new-session\s+'new-session\s+-s\s+\"%%\"'/new-session/g" "$cfg"
# perl -p -i -e "s/\bcommand-prompt\s+-p\s+new-session\s+\"new-session\s+-s\s+'%%'\"/new-session/g" "$cfg"
# fi
#
# tmux_conf_new_session_retain_current_path=${tmux_conf_new_session_retain_current_path:-true}
# if ! _is_disabled "$tmux_conf_new_session_retain_current_path" && _is_true "$tmux_conf_new_session_retain_current_path"; then
# perl -p -i -e "
# s/(?<!\bcommand-prompt -p )\bnew-session\b/new-session -c '#{pane_current_path}'/g" \
# "$cfg"
# else
# perl -p -i -e "
# s/\bnew-session\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-session\1/g" \
# "$cfg"
# fi
#
# tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false}

View File

@ -13,6 +13,12 @@
# - disabled (do not modify new-session bindings)
tmux_conf_new_session_prompt=false
# new session retains current path, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-session bindings)
tmux_conf_new_session_retain_current_path=false
# -- windows & pane creation ---------------------------------------------------