Command-line tools
For the purposes of this sections, I'm going to assume you have a command line tool(s) which
- output the clipboard on stdout (
clippaste
)
- reads stdin and places it in the clipboard (
clipcopy
)
With these, you can use
vipe (available with moreutils)
vipe is the pipe editor (it uses your actual EDITOR
, so it doesn't have to be vim).
Run at a shell:
clippaste | vipe | clipcopy
Manual vipe:
Run at a shell:
clippaste > /tmp/clip
vim /tmp/clip # in bash, you can abbreviate as 'vim !$'
clipcopy < /tmp/clip
clippaste and clipcopy
By OS:
- macOS:
pbpaste
and pbcopy
- *nix:
xclip -selection c -o
and xclip -selection c
- *nix:
xsel
(?)
Registers
In vim, use the clipboard register:
:enew | put * | 0delete
Then
:%yank * | bdelete