8

GitHub - aymanbagabas/shcopy: 📋 Copy text to your system clipboard locally and r...

 1 year ago
source link: https://github.com/aymanbagabas/shcopy
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

shcopy

Shell Copy is a simple utility that copies text to the clipboard from anywhere using ANSI OSC52 sequence. It works with local terminals (/dev/tty*) and remote terminals (SSH, Telnet).

Example

# Copy command output to clipboard
echo "Hello World" | shcopy

# Copy file content to clipboard
shcopy < file.txt

# Copy from stdin until EOF
shcopy # Ctrl+D to finish

# Need help?
shcopy --help

Installation

Go Install

go install github.com/aymanbagabas/shcopy@latest

Homebrew

brew install aymanbagabas/tap/shcopy

Debian/Ubuntu

echo 'deb [trusted=yes] https://repo.aymanbagabas.com/apt/ /' | sudo tee /etc/apt/sources.list.d/aymanbagabas.list
sudo apt update && sudo apt install shcopy

Fedora

echo '[aymanbagabas]
name=Ayman Bagabas
baseurl=https://repo.aymanbagabas.com/yum/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/aymanbagabas.repo
sudo yum install shcopy

Arch Linux

yay -S shcopy-bin

Scoop (Windows)

scoop bucket add aymanbagabas https://github.com/aymanbagabas/scoop-bucket.git
scoop install aymanbagabas/shcopy

You can also download the latest binaries and packages from the releases page.

Supported Terminals

This is a non-exhaustive list of the status of popular terminal emulators regarding OSC52 1:

Starting with tmux 3.3, the allow-passthrough option is disabled by default. This means that shcopy will not work in tmux by default. To enable it, add the following to your tmux config:

set -g allow-passthrough on

or use the following if you have set-clipboard on in your ~/.tmux.conf:

# set the terminal to default
echo "Hello, World!" | shcopy -t default

Credits

This project is built on top of go-osc52, based on vim-oscyank.

Footnotes

  1. Originally copied from vim-oscyank


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK