From cd5120850c476a9f22cb0941ea0351293a5c3784 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 17 Aug 2022 12:37:26 -0500 Subject: [PATCH] Bug fixing --- plugin.sh | 5 ++--- tmux_copy_last_command_output.tmux | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin.sh b/plugin.sh index ff0b8e7..0143f1e 100755 --- a/plugin.sh +++ b/plugin.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -x=$(tmux capture-pane -p -S '-') +x=$(tmux capture-pane -p -S '-' -J -t !) PROMPT_PATTERN=${1:-' ) '} result=$(echo "$x" | tac | sed -e "0,/$PROMPT_PATTERN/d" | sed "/$PROMPT_PATTERN/,\$d" | tac) - -echo -n "$result" | xclip -sel clip +echo -n "$result" | xsel -ib diff --git a/tmux_copy_last_command_output.tmux b/tmux_copy_last_command_output.tmux index 2389104..3385327 100755 --- a/tmux_copy_last_command_output.tmux +++ b/tmux_copy_last_command_output.tmux @@ -6,6 +6,8 @@ default_capture_key="g" CAPTURE_KEY=$(tmux show-option -gqv @command-copy-key) CAPTURE_KEY=${CAPTURE_KEY:-$default_capture_key} +default_prompt_pattern=" ) " PROMPT_PATTERN=$(tmux show-option -gqv @command-copy-prompt-pattern) +PROMPT_PATTERN=${PROMPT_PATTERN:-$default_prompt_pattern} -tmux bind $CAPTURE_KEY run-shell "$CURRENT_DIR/plugin.sh $PROMPT_PATTERN" +tmux bind $CAPTURE_KEY new-window -n -d last-command-output -e PROMPT_PATTERN="$PROMPT_PATTERN" "$CURRENT_DIR/plugin.sh"