fixed _apply_bindings() to support paths with spaces
_split_window() needs to be given -c '#{pane_current_path}', properly quoted
This commit is contained in:
parent
cb2bd9f378
commit
9e25f3a550
1 changed files with 28 additions and 32 deletions
60
.tmux.conf
60
.tmux.conf
|
@ -712,51 +712,47 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# _apply_bindings() {
|
||||
# cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT
|
||||
#
|
||||
# tmux list-keys | grep -vF 'tmux.conf.local' | grep -E '(new-window|split(-|_)window|new-session|copy-selection|copy-pipe)' > "$cfg"
|
||||
# tmux list-keys | grep -vF 'tmux.conf.local' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg"
|
||||
#
|
||||
# # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the
|
||||
# # output of list-keys can be truncated
|
||||
# perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg"
|
||||
#
|
||||
# perl -p -i -e "
|
||||
# s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g
|
||||
# ;
|
||||
# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_tty}\2\5\1/g
|
||||
# ;
|
||||
# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{pane_tty\}\3)(.*?)\2/split-window\4/g
|
||||
# ;
|
||||
# s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \
|
||||
# "$cfg"
|
||||
#
|
||||
# tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false}
|
||||
# if _is_enabled "$tmux_conf_new_window_retain_current_path"; then
|
||||
# perl -p -i \
|
||||
# -e "s/\b(new-window)\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/" \
|
||||
# -e ';' \
|
||||
# -e "s/\bnew-window\b(?!([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2))/new-window -c '#{pane_current_path}'/g" \
|
||||
# perl -p -i -e "
|
||||
# s/\bnew-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/
|
||||
# ;
|
||||
# s/\bnew-window\b/new-window -c '#\{pane_current_path\}'/g" \
|
||||
# "$cfg"
|
||||
# else
|
||||
# perl -p -i -e "s/\bnew-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)/new-window\1/g" "$cfg"
|
||||
# fi
|
||||
#
|
||||
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
|
||||
# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
|
||||
# perl -p -i -e "s/\bsplit-window\b(?!([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2))/split-window -c '#{pane_current_path}'/g" "$cfg"
|
||||
# else
|
||||
# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" "$cfg"
|
||||
# fi
|
||||
#
|
||||
# tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
|
||||
# if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then
|
||||
# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
|
||||
# perl -p -i \
|
||||
# -e "s/\bsplit-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1\3 -c #\{pane_current_path\}'/g" \
|
||||
# -e ';' \
|
||||
# -e "s/\b_split_window\b\s+#\{pane_tty\}(.*?)\s+-c\s+\\\\\"#\{pane_current_path\}\\\\\"\"/_split_window #{pane_tty}\1 -c \\\\\"#{pane_current_path}\\\\\"\"/g" \
|
||||
# "$cfg"
|
||||
# else
|
||||
# perl -p -i \
|
||||
# -e "s/\bsplit-window\b([^;}\n]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1'/g" \
|
||||
# -e ';' \
|
||||
# -e "s/\b_split_window\b\s+#\{pane_tty\}(.*?)\s+-c\s+\\\\\"#\{pane_current_path\}\\\\\"\"/_split_window #{pane_tty}\1\"/g" \
|
||||
# "$cfg"
|
||||
# fi
|
||||
# else
|
||||
# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
|
||||
# perl -p -i -e "s/\brun-shell\b(\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\})(.*?)\s+-c\s+#\{pane_current_path\}\2/split-window\3 -c '#{pane_current_path}'/g" "$cfg"
|
||||
# else
|
||||
# perl -p -i -e "s/\brun-shell\b(\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\})(.*)\2/split-window\3/g" "$cfg"
|
||||
# fi
|
||||
# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_tty\}\1'/g" "$cfg"
|
||||
# fi
|
||||
#
|
||||
# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
|
||||
# perl -p -i -e "
|
||||
# s/\bsplit-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/
|
||||
# ;
|
||||
# s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g
|
||||
# ;
|
||||
# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window #\{pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\1'/g if /\bdisplay-menu\b/
|
||||
# ;
|
||||
# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window #\{pane_tty\} -c \"#\{pane_current_path\}\"\1'/g" \
|
||||
# "$cfg"
|
||||
# fi
|
||||
#
|
||||
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
|
||||
|
|
Loading…
Reference in a new issue