bew / dotfiles

All my dotfiles in one place!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The beauty of having multiple copy-buffer

bew opened this issue · comments

Posted originally in Wezterm's Matrix channel.

Here is a small try at explaining why I think it has value. Take what you want! ¯\_(ツ)_/¯

You may not use this, but vim for example has registers, which can be used as temporary buffers to copy text, manipulate it, save macros, access some internals of vim, interact with the system clipboard, or get multiple info from different registers at a given time.

Vim has 26 settable registers (one per letter of the alphabet). I definitely don't use them all at once it would be a nightmare to remember what goes where, but it really has its uses sometimes..
Iirc I used 6 registers at once, once, to write a pretty complex macro! (but anyway..)

The default register (when you copy/cut/paste normally) is similar to X11's primary selection for me, I use it by default for quick changes, simple copies etc. It's a short-lived temporary buffer, I trust it's content for my next 1 or 2 next actions maximum.
For things I know I want to keep for something later, (or if I need to use that text in another program) I use the other registers, or for X11 the system clipboard.

Reply by Wez

(I personally think having multiple copy and paste buffers is a pretty awful UX!)

the vim usage makes sense to me, because it doesn't map to the clipboard or copy and paste concept. It's even called something else: "yanking" rather than copying.

What I think is broken about X11 is that clipboard and selection are so similar, and most people are used to literally all other operating systems where there is just a clipboard. I've seen so many people get tripped up by the two things being separate. One engineer I know laboriously reaches for the mouse to right click and select the "Copy" menu to make sure that text is actually copied to the clipboard whether they are using a terminal or a browser; they don't trust that keyboard shortcuts will populate the right thing :-/

The primary selection is really "the last selected text", it shouldn't be taken as the same thing as the clipboard imo.

The current default being "copy to clipboard when selecting text" is an unfortunate shortcut. The primary selection should be used and set only for "the last selected text", other explicit copies should always go to the clipboard.
I see it as the most sensible thing to do.

Any other behavior is confusing I think