1
0
Fork 0
mirror of synced 2024-11-17 23:15:35 -05:00

made bindings reinjection more robust. Closes #89

This commit is contained in:
Gregory Pakosz 2017-06-23 20:16:08 +02:00
parent 09fc3d5b48
commit 513e77b03b

View file

@ -252,9 +252,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# *Darwin*)
# while IFS= read -r line; do
# if [ x"$discharging" != x"true" ]; then
# discharging=$(echo "$line" | grep -qi "discharging" && echo "true" || echo "false")
# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false")
# fi
# percentage=$(echo "$line" | grep -E -o '[0-9]+%')
# percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%')
# charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }')
# count=$((count + 1))
# done << EOF
@ -285,9 +285,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# while IFS= read -r line; do
# [ -z "$line" ] && continue
# if [ x"$discharging" != x"true" ]; then
# discharging=$(echo "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }')
# discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }')
# fi
# charge=$(echo "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }')
# charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }')
# count=$((count + 1))
# done << EOF
# $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining | tr -d '\r' | tail -n +2)
@ -624,13 +624,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false}
# while IFS= read -r line; do
# [ -z "$line" ] && continue
# left=$(echo "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_new_window_retain_current_path"; then
# right=$(echo "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/new-window$/new-window -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 's/new-window$/new-window -c "#{pane_current_path}"/g')
# else
# right=$(echo "$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/-c[ \t]+"#\{pane_current_path\}"$//g')
# fi
# eval "tmux $left $right"
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-window\(\s\+-c\s\+"#{pane_current_path}\|$\)')
# EOF
@ -638,13 +638,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
# while IFS= read -r line; do
# [ -z "$line" ] && continue
# left=$(echo "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# 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=$(echo "$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 's/split-window([ \t]+-(h|v))?$/& -c "#{pane_current_path}"/g')
# else
# right=$(echo "$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/-c[ \t]+"#\{pane_current_path\}"$//g')
# fi
# eval "tmux $left $right"
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# EOF
@ -652,13 +652,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
# while IFS= read -r line; do
# [ -z "$line" ] && continue
# left=$(echo "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# 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=$(echo "$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([^;]+)/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 's/split-window([^;]+)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g')
# else
# right=$(echo "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -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/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]+)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g')
# fi
# eval "tmux $left $right"
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# EOF
@ -666,13 +666,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
# while IFS= read -r line; do
# [ -z "$line" ] && continue
# left=$(echo "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_new_session_prompt"; then
# right=$(echo "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/new-session$/command-prompt -p new-session \"new-session -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/new-session$/command-prompt -p new-session \"new-session -s %%\"/g')
# else
# right=$(echo "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }'| sed -E -e 's/command-prompt -p new-session[^;]+/new-session/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/command-prompt -p new-session[^;]+/new-session/g')
# fi
# eval "tmux $left $right"
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-session')
# EOF
@ -685,25 +685,28 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# command -v clip.exe > /dev/null 2>&1 && command='clip\.exe'
# [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard'
#
# # 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)
# prefix=${line%copy-*}
# column=${#prefix}
#
# while IFS= read -r line; do
# if [ -n "$command" ]; then
# # 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)
# prefix=${line%copy-*}
# column=${#prefix}
# [ -z "$line" ] && continue
# left=$(echo "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then
# right=$(echo "$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=$(echo "$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"
# done << EOF
#
# while IFS= read -r line; do
# [ -z "$line" ] && continue
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# 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")
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe')
# EOF
# done
# done
# fi
# }
#
# _apply_theme() {