mirror of
https://github.com/Myzel394/tmux-biff.git
synced 2025-06-18 07:25:28 +02:00
feat: Add plugin
This commit is contained in:
commit
965906e68b
19
plugin.sh
Executable file
19
plugin.sh
Executable 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
7
tmux-buff.tmux
Executable 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"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user