-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate the clipboard provider into Neovim-Qt #298
Comments
Waiting on neovim/neovim#6030 neovim/neovim#6029. If possible implement the provider in the shim. |
Implemented the feature in neovim! |
Implement a clipboard provider in the GUI shim. Calls to the provider are handled by the GUI that provides access to its clipboard. Vim (and Neovim) stores the selection type along with data in the clipboard. To achieve this the selection type (a string) is stored in the clipboard with the mimetype application/x-nvim-selection-type. Fixes #298.
Implement a clipboard provider in the GUI shim. Calls to the provider are handled by the GUI that provides access to its clipboard. Vim (and Neovim) stores the selection type along with data in the clipboard. To achieve this the selection type (a string) is stored in the clipboard with the mimetype application/x-nvim-selection-type. Fixes #298.
Hi @equalsraf When will the tb-clipboard branch merge into master branch? |
@skt041959 as it is it wont be merged. Ideally some kind soul (or me if time allows it) would add support upstream to override the clipboard provider using a function instead of using a custom executable. |
Moving on this after pushing some bits upstream - now in #479 |
FYI #479 has been merged.It is NOT enabled by default. You need to call
This essentially sets I plan to tag a new release with this so everyone can test it. Keep in mind this requires the master branch from nvim (0.3.2) |
Dont know if anyone has been using or following this. So here is a quick update has a note for me to follow later on. There are a couple of problems with this right now
The second part is already in #498. It is still unclear to me if the first part can or should be addressed in the shim. TLDR; 🤦♂️ |
I use this and it works great except that every once in awhile it doesn't initialize properly and I have to restart neovim until it does, I'm assuming for the reasons you mention |
I've also been trying to use this but I can't seem to make it work when connecting to a remote neovim using # on server foo
ky@foo $ nvim --listen foo:7777 --headless # on local machine bar
ky@bar $ nvim-qt --server foo:7777
# in nvim-qt
: call GuiClipboard() When running Finally, when nvim-qt spawns its own neovim on my local machine, calling GuiClipboard works as expected. Using neovim 3.4 and latest neovim-qt from master branch. |
Precisely. Neovim caches the clipboard setup, so if you come in too late it does not work. This happens almost every time with remote instances (to my great frustration since i work mostly with a remote instance). @kwon-young you can try to work around it by moving the shim plugin loading to be as early as possible and immediately call GuiClipboard(). |
@equalsraf would it help if Nvim set up a |
Nope. I think the real issue is that has_clipboard gets cached in eval.c. checkhealth actually reports ok for the provider, but any call to grab data from it via getreg prints No provider: Try checkhealth... despite g:clipboard being set. Calling the provider manually via I need to sit down for a couple of days to try and figure a way to fix that without breaking other stuff. |
Can we enable this by default? |
hi @krishnakumarg1984, good question, how is this feature working for you so far? |
I didn't face any reliability issues when copying from remote servers and seems stable enough for me. Is there some automated testing possible to thoroughly test this feature before deciding to enable by default? |
Strange, remote servers are precisely the case we are still struggling with. I usually dont get a working clipboard. .> Is there some automated testing possible to thoroughly test this feature The only test at the moment is this but it does not test for remote instances. |
I have tried to get GuiClipboard working with a windows instance of neovim-qt and a linux instance of neovim without any success. I am using both the latest rev of neovim-qt, the shim plugin and neovim (I have tried both with and without the patch in your gist). I have tried calling GuiClippboard() both in gInit and after I had attached to my session. |
hi @Kraust It is very strange that you see no errors. It seems more likely that the gui clipboard is not being activated. Can you quickly check a couple of things?
|
First time, with call GuiClipboard() in my ginit.vim:
(I have
Note: I re-ran :checkhealth here and still got the same as above. (I did a
I get the contents of my Windows clipboard and not the contents of my Linux one. Note, to further add, if I am running an xserver on windows (e.g. Xming) I can get my clipboard via x11 forwarding only if I have a terminal session up (which is what you'd expect). I am not doing that in my above testing. Second time without
Here if I yank something again, I still get the same error in :echo getreg('+') and it does not get sent to my windows clipboard. |
Yeah that is consistent with what we are seeing here
You said you were trying using the patch from the gist. How are you using it? You should follow a call to GuiClipboard() with |
So... just to understand, |
@dakom both the plus and star register will not work if GuilClipboard was called. |
I'm not familiar with that function... I see it mentioned above, but is there a way to get yank/paste to work with the clipboard in windows? |
@dakom the clipboard should already work in windows. This issue is about the case when using the local clipboard with a remote instance of neovim - which users enable using that function. If you are having issues in general with the clipboard you can open another issue. But if it is not working it is likely some issue with neovim, since it should be working out of the box. |
ugh was a silly mistake on my part ;) nm |
No worries I'd rather have a silly problem than a hard bug. |
Very simple workaround.
and modify function! s:clipboard.get(reg) abort
so I just added
@equalsraf Thank you for Neovim-Qt |
|
@equalsraf Just want to mention that I'm on windows and I suffer from what I assume is this issue a lot. Often, after nvim-qt starts up, the + register will not work as expected. Copying from outside nvim-qt and the attempting to paste inside nvim-qt does not use the copied value. When this issue occurs, the I can reproduce this with
And
With just these settings, I can start nvim-qt and randomly find that the Edit: I should also mention that I want to use this feature because the default (win32yank) is very flaky and causes other (worse) issues for me Edit2: Noticed a couple other things when this issue occurs. If I execute |
Just want to mention that I was able to resolve this for myself by doing the following:
|
Thanks @svermeulen. The question now is how to merge this upstream in a way that does not break other stuff - as it is that reloadprovider thing is not very safe. |
neovim/neovim#10161 was merged, can this issue be closed now? Or what's remaining? |
I've been using this for a few weeks now. Works fine, just missing some niceties in the shim plugin. To enable
If you are reconnecting the UI you need to call it again. Since the UI autocommands were also merged, it is simply a matter of calling GuiClipboard() from the autocommand (assuming neovim supports it). Otherwise placing a call in ginit.vim is also an option. Just a quick reminder that you need o install the gui shim on the neovim host side. |
@equalsraf are you planning to enable guiclipboard by default eventually? |
After successfuly loading the shim call GuiClipboard to enable the native GUI clipboard. ref #298
After successfuly loading the shim call GuiClipboard to enable the native GUI clipboard. ref #298
It should still be there. Are other gui functions or commands available? When in doubt you can check |
@equalsraf Ah, thanks, I'm using |
use ssh with -Y key to make clipboard work without GuiClibboard() call |
After successfuly loading the shim call GuiClipboard to enable the native GUI clipboard. ref #298
After successfuly loading the shim call GuiClipboard to enable the native GUI clipboard. - A new command GuiClipboard enables/disables the clipboard. - Internally the Shim keeps the state of the setting and sets autocommands to reconfigure the clipboard on UI attachment. The old function GuiClipboard is kept for compatibility. ref #298
After successfuly loading the shim call GuiClipboard to enable the native GUI clipboard. - A new command GuiClipboard enables/disables the clipboard. - Internally the Shim keeps the state of the setting and sets autocommands to reconfigure the clipboard on UI attachment. The old function GuiClipboard is kept for compatibility. ref #298
Having issues with the latest build on a local machine (not a remote one). We need to implement native support for this asap. Switched back to
|
After successfuly loading the shim call GuiClipboard to enable the native GUI clipboard. - A new command GuiClipboard enables/disables the clipboard. - Internally the Shim keeps the state of the setting and sets autocommands to reconfigure the clipboard on UI attachment. The old function GuiClipboard is kept for compatibility. ref #298
We talked about this some time ago on IRC, but I felt that it might be best to put the feature request down here.
I'm using Neovim-Qt mostly to connect to remote Neovim sessions over SSH. One of my initial motivations to do so was because I thought that would solve the clipboard problem. Unfortunately the clipboard is still handled by the remote Neovim session.
It would be great if the
+
and*
registers would point to the local system clipboard, the one running Neovim-Qt.Thank you very much for considering.
The text was updated successfully, but these errors were encountered: