AckslD / nvim-neoclip.lua

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

Config parameter to set max_size of clipboard entry #55

Closed marcomayer closed 2 years ago

marcomayer commented 2 years ago

When using permanent storage and having lots of data in the clipboard, sqlite gets into trouble and exiting nvim takes forever. Sometimes when editing huge files this is unwanted, and so it would be nice to have a config parameter like max_size that limits the maximum number of bytes to be stored, everything else gets truncated.

AckslD commented 2 years ago

That makes sense @marcomayer! Two questions:

  1. Would you say that entries which are bigger than max_size are simply ignored or truncated? To me it seems better to simply ignore the whole entry since would you ever actually want to later use a truncated entry?
  2. Do you just want to limit what is written to the database or also what's stored in the history in the current session?

Depending on this you could use a custom filter and filter out any entry which is too big.

I'm also open to adding a setting like this, just want to make sure I understand the usecase :)

Also I think the easier thing would have max_size specified as number of characters which I guess does not make much difference, does that seem fine to you?

If you think this should be a setting and not a filter, would you like to implement it, should be a relatively simply change. If not no problem!

marcomayer commented 2 years ago

Thanks for your response @AckslD!

Like you said just filtering out entries that are larger than N chars does the job. The issue really is around the permanent storage, so that would be a good solution.

AckslD commented 2 years ago

Cool @marcomayer, do I understand you correctly that the filtering solution if sufficient for you? Since it also then filters out what's get stored in the permanent storage.

marcomayer commented 2 years ago

Yup, thanks!