jupyter-vim-binding icon indicating copy to clipboard operation
jupyter-vim-binding copied to clipboard

`click`-event friendly system-clipboard copying of text

Open ELLIOTTCABLE opened this issue 9 years ago • 5 comments

So, as documented in the README, yy doesn't work as naively expected (it doesn't copy to the system clipboard); and worse, ⌘C doesn't either (although it does copy the selected text to the system clipboard, this behaviour is in no way visible to the user, and it doesn't also copy to the vim clipboard; so the two are, unintuitively, completely distinct.)

Here is my proposed solution: when the user hits yy, copy the content to the buffer, and the pop up an unobtrusive notification below the copied text (something like the <C-g> mapping's little info-box), that says something like this:

Text yanked! Hit ⌘C or click here to copy it to your clipboard: [copy] [?]

… where the [?] links to the “why is this necessary” blurb in the README.

Similarly, this should work in reverse: upon a ‘copy’ event from the system clipboard (i.e. user hits ⌘C without having previously hit yy and gotten that popup), the content should also be copied into the vim buffer, and the selection should be discarded (thus providing visual feedback that the copying occurred.)

Is my explanation clear? This exposes the precise behaviour of the system clipboard to the user, as clearly as possible; and discards any responsibility on this plugin's part to deal with the limitations thereof. I also think it'll provide a smoother user-experience for newcomers. (=

ELLIOTTCABLE avatar Feb 22 '16 18:02 ELLIOTTCABLE

it sounds worth to try thanks! I'll think about this when I got time. btw, do you have ideas about paste?

lambdalisue avatar Feb 23 '16 01:02 lambdalisue

I'm not sure of the limitations there; I was working off of what you'd written in the README. What's the problem look like?

ELLIOTTCABLE avatar Feb 23 '16 22:02 ELLIOTTCABLE

Well, paste content of system clipboard is not possible with p key. This is a problem

lambdalisue avatar Feb 24 '16 03:02 lambdalisue

I'd posit that that isn't as big of a concern, to be honest: In fact, I'd prefer (even if it were possible) for p to paste the unnamed vim-specific register; even if you could access the system pasteboard, I'd prefer that functionality to be behind "*p.

I think the popup-on-y, and error-on-"*y, are enough to satisfy principle-of-least-surprise. What do you think?

ELLIOTTCABLE avatar Feb 28 '16 07:02 ELLIOTTCABLE

Sorry for late reply. I read and then forgot to reply :pensive:

I'd posit that that isn't as big of a concern, to be honest: In fact, I'd prefer (even if it were possible) for p to paste the unnamed vim-specific register; even if you could access the system pasteboard, I'd prefer that functionality to be behind "_p. I think the popup-on-y, and error-on-"_y, are enough to satisfy principle-of-least-surprise. What do you think?

The biggest problem for Ctrl-V is that you cannot paste text in Normal mode. But yeah, it is too difficult to implement so I maybe should forget about it.

I'll implement what you suggest when I got time. It would take time while it requires some UI codes as well.

lambdalisue avatar Mar 03 '16 16:03 lambdalisue