1
0
Fork 0
mirror of synced 2024-12-22 06:41:07 -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*) # *Darwin*)
# while IFS= read -r line; do # while IFS= read -r line; do
# if [ x"$discharging" != x"true" ]; then # 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 # 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 }') # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }')
# count=$((count + 1)) # count=$((count + 1))
# done << EOF # done << EOF
@ -285,9 +285,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue # [ -z "$line" ] && continue
# if [ x"$discharging" != x"true" ]; then # 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 # 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)) # count=$((count + 1))
# done << EOF # done << EOF
# $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining | tr -d '\r' | tail -n +2) # $(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} # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false}
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue # [ -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 # 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 # 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 # fi
# eval "tmux $left $right" # eval "tmux $left $right" 2>/dev/null || true
# done << EOF # done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-window\(\s\+-c\s\+"#{pane_current_path}\|$\)') # $(tmux list-keys 2>/dev/null | grep -e 'new-window\(\s\+-c\s\+"#{pane_current_path}\|$\)')
# EOF # 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} # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue # [ -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 # 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 # 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 # fi
# eval "tmux $left $right" # eval "tmux $left $right" 2>/dev/null || true
# done << EOF # done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window') # $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# EOF # 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} # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue # [ -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 # 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 # 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 # fi
# eval "tmux $left $right" # eval "tmux $left $right" 2>/dev/null || true
# done << EOF # done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window') # $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# EOF # 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} # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue # [ -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 # 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 # 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 # fi
# eval "tmux $left $right" # eval "tmux $left $right" 2>/dev/null || true
# done << EOF # done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-session') # $(tmux list-keys 2>/dev/null | grep -e 'new-session')
# EOF # 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' # command -v clip.exe > /dev/null 2>&1 && command='clip\.exe'
# [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard' # [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard'
# #
# if [ -n "$command" ]; then
# # shellcheck disable=SC2086 # # shellcheck disable=SC2086
# for table in "" "-t emacs-copy" "-t vi-copy"; do # 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) # line=$(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe' | head -1)
# prefix=${line%copy-*} # prefix=${line%copy-*}
# column=${#prefix} # column=${#prefix}
# [ -z "$line" ] && continue
# #
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue # [ -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_copy_to_os_clipboard"; then # 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") # 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 # 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") # 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 # fi
# eval "tmux $left $right" # eval "tmux $left $right" 2>/dev/null || true
# done << EOF # done << EOF
# $(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe') # $(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe')
# EOF # EOF
# done # done
# fi
# } # }
# #
# _apply_theme() { # _apply_theme() {