Earlier quoted context omitted.
> The only place I've seen the word "yank" in computing is in Emacs context, where it means "paste", not "copy"... This is a confusing difference between Emacs and Vim. Emacs uses it for pasting, Vim uses it for copying.
How did the Emacs developers ever thought "yank" would convey the meaning of "paste"? (Legitimate question. I'm aware some UX faux-pas do happen, but I don't see how)
Yank: Yank Terminal Output to Clipboard
31–40 of 57 posts
Re: Yank: Yank Terminal Output to Clipboard
#32Useful tool indeed, thanks for sharing. I use clipper[1], which delivers a similar function through a different implementation. What I like about that one is that with right config you can also pipe output from remote servers back into your machine's clipboard, which is quite handy in so many situations. [1] https://github.com/wincent/clipper
printf "\033]52;c;$(printf "%s" "blabla" | base64)\a"
Re: Yank: Yank Terminal Output to Clipboard
#33Earlier quoted context omitted.
That works outside WSL2, not inside, right?
clip.exe works to and from WSL 2. But if you run VcXsrv you can use the native Linux clipboard and have it shared between WSL 2 and Windows. This is what I do because then tools like Vim, the pass utility and other command line tools can write to and read from the native Linux clipboard and everything will work out of the box. If you wanted to reproduce pbcopy / pbpaste in native Linux or WSL 2 you can set up aliases…
Re: Yank: Yank Terminal Output to Clipboard
#34This is actually a solution to a problem I've been looking at recently. My current experimental answer is using the terminal within Neovim, which is kind of a superset of this in some ways. I'm wondering if there's a standard way to invoke vim and just get a selection. Might make a good analog for vim users who don't want to commit to using its terminal.
Re: Yank: Yank Terminal Output to Clipboard
#35There seems to be multiple clipboards and I have no idea when I am using which. I generally spam some combination of ctrl-v, shift-insert, rightclick context menu paste, middleclick, etc until I get what I want.
I've abandoned vim for a gui solely because I have no idea how to copy stuff to/from it.
Can someone finally explain it to me? Or tell me what to do to make it sane.
(it of course did occur to me to google the question over the past 10 years but every time I did, I didn't find a satisfactory answer for something that ought to be a basic computer literacy skill)
Re: Yank: Yank Terminal Output to Clipboard
#36I've been using ubuntu for over a decade and I have no idea how the clipboard works. There seems to be multiple clipboards and I have no idea when I am using which. I generally spam some combination of ctrl-v, shift-insert, rightclick context menu paste, middleclick, etc until I get what I want. I've abandoned vim for a gui solely because I have no idea how to copy stuff to/from it. Can someone finally explain it to…
Re: Yank: Yank Terminal Output to Clipboard
#37I've been using ubuntu for over a decade and I have no idea how the clipboard works. There seems to be multiple clipboards and I have no idea when I am using which. I generally spam some combination of ctrl-v, shift-insert, rightclick context menu paste, middleclick, etc until I get what I want. I've abandoned vim for a gui solely because I have no idea how to copy stuff to/from it. Can someone finally explain it to…
For terminals, ctrl-c/Ctrl-v have conflicting interpretations so are usually bound to ctrl-shift-c/ctrl-shift-v. Some (e.g. iterm) try to emulate copy on select on operating systems that don't support it by copying the selection to the single clipboard.
For vim, the selections are bound to buffers. * Is the primary/selection buffer, + is the clipboard. Use "+y/"+p for ctrl-c/ctrl-v equivalents, or "*y/"*p for copy-on-select/middle click equivalents. Note that some distros ship a default "vim-minimal"/"vim-tiny" package built without this support so they can use it as "vi" for POSIX compatibility without pulling in x11 libraries. In that case look for a "vim-x11", "vim-full" or "gvim" package. Or use neovim, I haven't seen packagers slice that up the same way. Depending on your terminal, you may be also able to use the GUI equivalents in insert mode anyway (don't try use your terminal paste in normal mode, it'll paste into the command buffer).
Shift-Insert is unfortunately application dependent. I think it _should_ be equivalent to middle click, but some apps treat it as ctrl-v.
Some clipboard managers or applications will overwrite the primary contents with the clipboard contents when you perform an explicit copy.
Re: Yank: Yank Terminal Output to Clipboard
#38I've been using ubuntu for over a decade and I have no idea how the clipboard works. There seems to be multiple clipboards and I have no idea when I am using which. I generally spam some combination of ctrl-v, shift-insert, rightclick context menu paste, middleclick, etc until I get what I want. I've abandoned vim for a gui solely because I have no idea how to copy stuff to/from it. Can someone finally explain it to…
primary = highlight / middle click
vim has its own used by default when you dd, p, etc. You can copy to one of the previous things (assuming your build enabled it) with "+y and "*y key sequences. You can also paste the same way, but I usually just let the term emu handle that with ctrl-shift-v or similar.
shift-insert is kinda weird actually. AFAIK it should paste from selection, but it often surprises me, so I avoid it.
edit: s/selection/primary/
Re: Yank: Yank Terminal Output to Clipboard
#39Earlier quoted context omitted.
> The only place I've seen the word "yank" in computing is in Emacs context, where it means "paste", not "copy"... This is a confusing difference between Emacs and Vim. Emacs uses it for pasting, Vim uses it for copying.
How did the Emacs developers ever thought "yank" would convey the meaning of "paste"? (Legitimate question. I'm aware some UX faux-pas do happen, but I don't see how)
Re: Yank: Yank Terminal Output to Clipboard
#40On Mac OS, a much less powerful but built in tool is `pbcopy`.
To replicate pbcoby on X11 systems, add to your bashrc: alias clip="xclip -selection clipboard" `echo hello | clip` will copy 'hello' to the clipboard, and similarly `ls | clip` will copy a bunch of lines to the clipboard. You might need to install xclip through your package manger (the package is just named xclip on Arch).