sainnhe/tmux-fzf

missing text format in paste buffer

paavaanan opened this issue · 2 comments

  • While text is copied into tmux-buffer, text formats like (newline/tabs/spaces) are discarded.
  • So, if you copy full logs you get everything in a single line.
  • Modified below code to retain text formatting.
diff --git a/scripts/clipboard.sh b/scripts/clipboard.sh
index 67a5e98..e2d3015 100755
--- a/scripts/clipboard.sh
+++ b/scripts/clipboard.sh
@@ -23,7 +23,8 @@ if [[ "$action" == "system" ]]; then
     [[ -z "${system_clipboard_history}" ]] && exit
     tmux send-keys -l "${system_clipboard_history}"
 elif [[ "$action" == "buffer" ]]; then
-    buffer_clipboard_history=$(tmux list-buffers | sed -E -e 's/^buffer[^/]*bytes: "//' -e 's/"$//' | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
+    buffer_clipboard_history=$(tmux list-buffers | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
+    selected_buffer=$(echo $buffer_clipboard_history | cut -d ":" -f1)
     [[ -z "${buffer_clipboard_history}" ]] && exit
-    tmux send-keys -l "${buffer_clipboard_history}"
+    tmux paste-buffer -b $selected_buffer
 fi

Thank you, this should be fixed now.

👍