mirror of
https://github.com/theniceboy/.config.git
synced 2025-12-26 22:54:59 +08:00
- copy-mode-vi: map to copy-pipe-and-cancel -> ~/.config/tmux/scripts/copy_to_clipboard.sh - add C-S-v and M-V to paste from system clipboard (works over SSH) - add scripts: paste_from_clipboard.sh, copy_to_clipboard.sh Only staged clipboard-related changes; other edits remain unstaged.
22 lines
787 B
Bash
Executable file
22 lines
787 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
content=$(cat | tr -d '\r')
|
|
# Update tmux buffer and system clipboard (uses tmux set-clipboard setting)
|
|
tmux set-buffer -w -- "$content"
|
|
|
|
# Best-effort: also call platform clip utilities when available
|
|
if command -v pbcopy >/dev/null 2>&1; then
|
|
printf '%s' "$content" | pbcopy || true
|
|
elif command -v wl-copy >/dev/null 2>&1; then
|
|
printf '%s' "$content" | wl-copy --type text || wl-copy || true
|
|
elif command -v xclip >/dev/null 2>&1; then
|
|
printf '%s' "$content" | xclip -selection clipboard || true
|
|
elif command -v xsel >/dev/null 2>&1; then
|
|
printf '%s' "$content" | xsel --clipboard --input || true
|
|
elif command -v powershell.exe >/dev/null 2>&1; then
|
|
powershell.exe -NoProfile -Command Set-Clipboard -Value @"
|
|
${content}
|
|
"@ || true
|
|
fi
|
|
|