Skip to content

Instantly share code, notes, and snippets.

@pastak
Last active May 15, 2019 10:29
Show Gist options
  • Save pastak/8223238b0c46fcc82db6 to your computer and use it in GitHub Desktop.
Save pastak/8223238b0c46fcc82db6 to your computer and use it in GitHub Desktop.
tmux-bpcopy
#!/bin/bash
if ! type pbcopy >/dev/null 2>&1 || ! type reattach-to-user-namespace >/dev/null 2>&1; then
tmux display-message "Error: cannot copy to clipboard."
exit 0
fi
COPY=$(tmux save-buffer -)
echo "$COPY" | ghead -c -1 | reattach-to-user-namespace pbcopy
# メッセージ表示
LINES=$(echo "$COPY" | wc -l | tr -d ' ')
tmux display-message "Copy: $LINES lines"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment