feat: Add plugin

This commit is contained in:
Myzel394 2024-06-20 20:18:47 +02:00
commit 965906e68b
No known key found for this signature in database
GPG Key ID: C154D692BB218E2E
2 changed files with 26 additions and 0 deletions

19
plugin.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Copy selection
tmux send-keys -X copy-selection
selected_text=$(tmux show-buffer)
if [[ -f /tmp/.tmux-biff-buffer-check ]]; then
tmux copy-mode -q
echo $selected_text > /tmp/.tmux-biff-buffer-check-2
mv /tmp/.tmux-biff-buffer-check /tmp/.tmux-biff-buffer-check-1
tmux new-window 'diff -u -U 9999 /tmp/.tmux-biff-buffer-check-1 /tmp/.tmux-biff-buffer-check-2 | delta --side-by-side; read -n 1'
else
echo $selected_text > /tmp/.tmux-biff-buffer-check
fi

7
tmux-buff.tmux Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
tmux bind-key -T copy-mode v run-shell "$CURRENT_DIR/plugin.sh"
tmux bind-key -T copy-mode-vi v run-shell "$CURRENT_DIR/plugin.sh"