AckslD / nvim-neoclip.lua

Clipboard manager neovim plugin with telescope integration
944 stars 20 forks source link

Multiple Register support - specifically clipboard - not loading in Telescope Preview #38

Closed ZacharyRizer closed 2 years ago

ZacharyRizer commented 2 years ago

Hi there,

I can't seem to get this piece of config to function as I would expect - default_register = {'"', '+', '*'}. I was expecting this to populate :Telescope neoclip with everything in those three registers, but I don't see anything form the '+' or '*' registers. Here is my neoclip setup in my init.nvim:

Screen Shot 2022-01-05 at 9 57 37 AM

Here is what the :Telescope neoclip shows:

Screen Shot 2022-01-05 at 9 58 58 AM

You can see at the top it is saying 'for registers ", +, *', but I don't see the contents of those last two registers. Here is the content of :registers

Screen Shot 2022-01-05 at 10 00 09 AM

Any help would be appreciated. Thanks.

AckslD commented 2 years ago

Hi @ZacharyRizer! neoclip only listens to the TextYankPost event for things that are yanked, it doesn't read directly from the registers and specifically doesn't check if eg "+ changed if you copied something outside neovim. So at least at the moment I think neoclip doesn't do what you were hoping, unless I might have misunderstood what you were trying to do.

ZacharyRizer commented 2 years ago

@AckslD no you understood perfectly and thank you for the response. If it is possible down the line to have things that were copied outside of Neovim (to the + and * registers) shown in the :Telescope neoclip buffer that woudl be amazing.

AckslD commented 2 years ago

@ZacharyRizer That would probably be nice indeed but I think this would maybe require some change to core neovim to for example have events triggered for these things. Cause I would like to avoid having something in neoclip continuously checking for changes and rather have it react to something.

ZacharyRizer commented 2 years ago

@AckslD thanks again for the response. I am not sure how vim-yankstack functions, but in that plugin the external clipboard is part of the yanks available to paste inside of neovim. You can see in this screen shot - the first is what I yanked from my browser, and the second two are from within neovim. Not sure how they implement it, but could be useful. Thanks again Screen Shot 2022-01-05 at 2 26 41 PM .

AckslD commented 2 years ago

Interesting, thanks for sharing @ZacharyRizer

AckslD commented 2 years ago

@ZacharyRizer Does it actually store a history of what was yanked outside neovim? What happens if you copy two different things outside neovim, do you only see the last. Looking at the source code it looks like it only looks up what's currently in eg "+.

ZacharyRizer commented 2 years ago

@AckslD - It only takes the most recent yank outside neovim. So if you copy two things it will only show the most recent outside neovim. It also looks like it replaces the most recent yank inside neovim with the yank you just took from outside.

So for instance if I yank two lines in neovim: Screen Shot 2022-01-05 at 2 55 31 PM

Then if I yank outside neovim once it looks like it replaces the first instance with the outside yank: Screen Shot 2022-01-05 at 2 56 05 PM

Then yanking outside neovim again just replaces that with the new yank: Screen Shot 2022-01-05 at 2 56 48 PM

And then yanking inside neovim again will continue to build the yankstack: Screen Shot 2022-01-05 at 2 57 26 PM

This plugin also has the nice feature of letting you cycle yanks easily with <M-p> and <M-P>. So if you know the yank you want is 2 yanks back you can just press <M-p> twice and see it cycle right inline without needing to open a window.