codemirror-vim icon indicating copy to clipboard operation
codemirror-vim copied to clipboard

Yanking And Pasting From System Clipboard

Open Archie-2021 opened this issue 3 years ago • 4 comments

Can you please make "+y or *+y and "+p or *+p available, it is very important and basic command and yet not implemented from vim. I know there a command to tell the vim use system clipboard. But vim mess with clipboard a lot so it is better imo to not to do that and instead use a different command for that.

thanks

Archie-2021 avatar Jul 05 '22 07:07 Archie-2021

Browsers do not provide access to the selection clipboard so * can't work correctly. Should it be an alias for +, or should it just stay unimplemented?

nightwing avatar Jul 16 '22 14:07 nightwing

I think it should stay unimplemented. On Windows an alias might make sense because they're the same clipboard, but not on Linux (and macOS; not 100% sure about that).

kometenstaub avatar Jul 16 '22 16:07 kometenstaub

Some discusison of this in the past here: https://github.com/codemirror/codemirror5/issues/3075

I also found that as a consumer of the vim API you can add yanking to the system clipboard with these two snippets:

https://github.com/ianhi/jupyterlab-vimrc/blob/2dedaf7f48b7b3bd462defda77ae3865fbff70e9/src/index.ts#L34-L37 https://github.com/ianhi/jupyterlab-vimrc/blob/main/src/yank.ts

ianhi avatar Jul 19 '22 15:07 ianhi

Some discusison of this in the past here: codemirror/codemirror5#3075

I also found that as a consumer of the vim API you can add yanking to the system clipboard with these two snippets:

https://github.com/ianhi/jupyterlab-vimrc/blob/2dedaf7f48b7b3bd462defda77ae3865fbff70e9/src/index.ts#L34-L37 https://github.com/ianhi/jupyterlab-vimrc/blob/main/src/yank.ts

i think this just set the clipboard to unnamed which i already use to solve the issue, but sometimes there is an app without any vimrc file to put it in, so a easier why to make copy pasting available is needed. i mean what is more important than that? i like to use vim everywhere i can find a plugin for it and many of them use code mirror to emulate it.

Archie-2021 avatar Jul 19 '22 16:07 Archie-2021

Closing since the + register works now, if there are additional feature requests please create a new issue.

nightwing avatar Feb 08 '23 20:02 nightwing

Is there a way to use a Userscript to yank to the clipboard with <c-c>, @nightwing? It seems Overleaf hasn't implemented the new +-registry patch yet.

llinfeng avatar Mar 01 '23 20:03 llinfeng

It's a very simple implementation, see this comment: https://github.com/replit/codemirror-vim/pull/36#issuecomment-1186192936

kometenstaub avatar Mar 01 '23 21:03 kometenstaub

@kometenstaub Thanks for the pointer. Though, from an end-user perspective, are you suggesting that I should find a way to edit /replace/override the vim.js file according to your commit, as linked? Then, I assume I should find a way to load this file from your commit?

llinfeng avatar Mar 02 '23 04:03 llinfeng

I just meant that it isn’t possible right now and someone would need to implement it.

kometenstaub avatar Mar 02 '23 08:03 kometenstaub

I see. Thanks for the clarification.

llinfeng avatar Mar 02 '23 15:03 llinfeng