From 38e29b6f7351b5906f082887248d51a57dc4fc43 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 30 Nov 2019 20:33:10 +0100 Subject: [PATCH] wip --- .tmux.conf | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 4b87a8c..a33cbf5 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -628,9 +628,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # _copy() { # tty="$SSH_TTY" -# tty=${tty:-$1} +# osc52=$1 +# tty=${tty:-$2} # tty=${tty:-$(tmux display -p '#{pane_tty}')} -# buffer=${2:-$(tmux save-buffer - || true)} +# buffer=${3:-$(tmux save-buffer - || true)} # # [ -z "$buffer" ] && return # @@ -650,7 +651,9 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # # OSC 52 # # see https://chromium.googlesource.com/apps/libapps/+/master/nassh/doc/FAQ.md#Is-OSC-52-aka-clipboard-operations_supported -# printf '\033Ptmux;\033\033]52;c;%s\a\033\\' "$(printf %s "$buffer" | head -c 74994 | base64 | tr -d '\r\n')" > "$tty" +# if _is_enabled "$osc52"; then +# printf '\033Ptmux;\033\033]52;c;%s\a\033\\' "$(printf %s "$buffer" | head -c 74994 | base64 | tr -d '\r\n')" > "$tty" +# fi # } # # _apply_overrides() { @@ -729,30 +732,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # fi # # 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' -# -# if [ -n "$command" ]; then -# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then -# perl -p -i -e "s/\bcopy-selection(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg" -# else -# perl -p -i -e "s/\bcopy-pipe(-and-cancel)?\b\s+(\"|')?$command\2/copy-selection\1/g" "$cfg" -# fi -# fi -# # tmux_conf_share_remote_clipboard=${tmux_conf_share_remote_clipboard:-false} -# if _is_enabled "$tmux_conf_share_remote_clipboard"; then -# if [ -n "$command" ]; then -# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then -# perl -p -i -e "s/\bcopy-selection(-and-cancel)?\b '$command'/$& cut -c3- ~\/\.tmux.conf | sh -s _copy #{pane_tty}/g" "$cfg" -# else -# perl -p -i -e "s/cut -c3- ~\/\.tmux.conf | sh -s _copy #\{pane_tty\}$//g" "$cfg" -# fi -# fi +# perl -p -i -e "s/\\\;\s+run-shell\s+(\"|')cut\s+-c3-\s+~\/\.tmux.conf\s+\|\s+sh\s+-s\s+_copy\s+.*?\s+#\{pane_tty\}\1$//g" "$cfg" +# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then +# perl -p -i -e "s/\bcopy-(pipe|selection)(-and-cancel)?\b.+$/$& \\\\; run-shell 'cut -c3- ~\/\.tmux.conf | sh -s _copy $tmux_conf_share_remote_clipboard #{pane_tty}'/g" "$cfg" # fi # # # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings