From ffc2dfbe788f755f5b17a4340f4acaf2f5155fd5 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 9 Jun 2019 10:02:23 +0200 Subject: [PATCH] made _apply_bindings() more robust --- .tmux.conf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index e69fab4..0ed5972 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -677,9 +677,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # [ -z "$line" ] && continue # left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g') # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then -# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/split-window([ \t]+-(h|v))?$/& -c "#{pane_current_path}"/g') +# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e '/#\{pane_current_path\}/!s/split(-|_)window([ \t]+#\{pane_tty\})?([ \t]+-(h|v))?/& -c "#{pane_current_path}"/g') # else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/-c[ \t]+"#\{pane_current_path\}"$//g') +# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/[ \t]+(-c[ \t]+(\\")?"#\{pane_current_path\}"(\\")?|-c #\{pane_current_path\})//g') # fi # eval "tmux $left $right" 2>/dev/null || true # done << EOF @@ -691,9 +691,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # [ -z "$line" ] && continue # left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g') # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/"/\\"/g' -e 's/split-window([^;]+)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g') +# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e '/_split_window/!s/"/\\"/g' -e 's/split-window([^;]*)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g') # else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/\\"/"/g' -e 's/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]+)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g') +# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/\\"/"/g' -e 's/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]*)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g') # fi # eval "tmux $left $right" 2>/dev/null || true # done << EOF @@ -726,9 +726,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # shellcheck disable=SC2086 # for table in "" "-t emacs-copy" "-t vi-copy"; do # line=$(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe' | head -1) +# [ -z "$line" ] && continue # prefix=${line%copy-*} # column=${#prefix} -# [ -z "$line" ] && continue # # while IFS= read -r line; do # [ -z "$line" ] && continue @@ -736,7 +736,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then # right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-selection(-and-cancel)?$/copy-pipe\1 \"$command\"/g") # else -# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-pipe(-and-cancel)? \"$command\"$/copy-selection\1/g") +# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-pipe(-and-cancel)? \"?$command\"?$/copy-selection\1/g") # fi # eval "tmux $left $right" 2>/dev/null || true # done << EOF