RetroFed Forum
Your home away from modern life.
Edit your clipboard in $EDITOR
Post Reply
AuthorMessage
[object Object] sh.itjust.works Object@sh.itjust.works
Joined: 2024-09-22
Quote

Requirements: moreutils, which contains vipe command, Wayland for clipboard. vipe is a command that takes in text, creates a temporary file with that text, and prints the content in the editor when it closes.

Code:

# Change editor if necessary. Also see the notes below.
# export EDITOR="kate -b"
wl-paste | vipe | wl-copy -n 2>/dev/null

How it works:

wl-paste: Gets your clipboard content, and print that

vipe: Gets the printed clipboard content, open an editor pre-filled with it

wl-copy: Gets the edited result, add it back to your clipboard without the newline at the end


Notes:

You must save the content in the editor before quitting.

The editor must not run detached. Otherwise, vipe thinks the editor is done editing, and does nothing. For example, use environment variable EDITOR="kate -b" (flag to make kate to run in blocking mode) to use kate for editing your clipboard.

1   Original
Post Reply
Back to top