diff --git a/.tmux.conf b/.tmux.conf index 3a0b4eb..dcc5d7e 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -720,35 +720,26 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # EOF # # tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false} -# command -v pbcopy > /dev/null 2>&1 && command='pbcopy' -# command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy' -# command -v xsel > /dev/null 2>&1 && command='xsel -i -b' -# ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1' -# 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\|append-selection' | head -1) +# [ -z "$line" ] && continue +# prefix=${line%copy-*} +# column=${#prefix} # -# 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} +# while IFS= read -r line; do # [ -z "$line" ] && continue -# -# 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') +# 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/;/\\\\\\\;/g' -e 's/-selection(-and-cancel)?$/-selection\1 \\\\\\\; run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _copy #{pane_tty}"/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 _copy #\{pane_tty\}"//g' -e 's/#\{.+\}/\"&\"/g') +# fi +# eval "tmux $left $right" 2>/dev/null || true +# done << EOF +# $(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|append-selection') # EOF -# done -# fi +# done # } # # _apply_theme() {