-
Notifications
You must be signed in to change notification settings - Fork 25
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
system clipboard support #58
base: main
Are you sure you want to change the base?
Conversation
lua/neoclip/telescope.lua
Outdated
@@ -162,6 +162,8 @@ local function get_export(register_names, typ) | |||
if opts ~= nil and opts.extra ~= nil then | |||
register_names = utils.join(register_names, parse_extra(opts.extra)) | |||
end | |||
-- NOTE: use system clipboard | |||
handlers.handle_system_yank() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wont this only show what's currently in eg "+
but not the history as for other registers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we would need some kind of event/trigger whenever these registers are changed from system but not sure that's possible, any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, history in other registers still can be seen
it just add "* and "+ into storage.yank additionally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, but i dont find any event related to "register changed".
maybe, we can simply set a command right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean a command/function that a user can call to add entries to the history? If so, would calling
require('neoclip.storage').insert({
regtype = regtype,
contents = regcontents,
filetype = vim.bo.filetype,
}, 'yanks')
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take a look at this issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would require("neoclip.handlers").handle_system_yank()
do differently than:
require('neoclip.storage').insert({
regtype = regtype,
contents = regcontents,
filetype = vim.bo.filetype,
}, 'yanks')
? Or would that be it?
Just to make sure I understand you suggestion correctly :)
Also are you suggesting that RegStarChange
be part of neoclip
? I think this can be done by the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would
require("neoclip.handlers").handle_system_yank()
do differently than:require('neoclip.storage').insert({ regtype = regtype, contents = regcontents, filetype = vim.bo.filetype, }, 'yanks')
nothing special but make sure that it's a unified code style, just like this
Also are you suggesting that
RegStarChange
be part ofneoclip
? I think this can be done by the user?
not necessary, user can do it in their own vimrc
I've noticed that TextPutPre
and TextPutPost
still working in progress, right now there's no event to trigger require("neoclip.handlers").handle_system_yank()
, sad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to add handle_system_yank
if that's useful for you.
Although I don't think we should modify the registers on delete
since we don't do that with other registers, rather it deletes from the history but the content of the registers remains.
Also I don't think handle_system_yank
should be called in the picker. It should be the task of the user to call it prior by whatever event/action is available.
I'm not sure eg TextPutPre
would help here though? Isn't that events triggered when pasting. But you want some trigger/event when a register is changed or when you copy something in your system clipboard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure eg
TextPutPre
would help here though? Isn't that events triggered when pasting. But you want some trigger/event when a register is changed or when you copy something in your system clipboard?
yes, if there is a trigger, we can just simply add a autocmd
autocmd REGCHANGED * :lua require("neoclip.handlers").handle_system_yank()
But I was noticed that the team of neovim has no plans about TextPutPre
and TextPutPost
or other event when register is changed.
I will change problem you mentioned, thank you
if neoclip.stopped then | ||
return | ||
end | ||
if not settings.enable_system_clipboard then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this setting is needed anymore since a user just wouldn't trigger this function
for _, register in ipairs({'+', '*'}) do | ||
local event = get_register_event(register) | ||
if #event.regcontents ~= 0 then | ||
if should_add(event) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about extracting a function from the current handle_text_yank
which takes and event
table and does the check for should_add
and neoclip.stopped
and we don't need to check it in more than one place?
Any news on this? I'm highly interested in getting support for |
@tuxflo or anyone else, feel free to continue this MR |
Any update on this PR? |
Not that I know, anyone can feel free to pick this up. |
Any update on this? I would be happy to pick this up, I wouldn't know where to begin, and I am not sure if I am knowledgable enough with Vim to work on this :( |
Same comment as above :) |
Telescope do not show the content copied from system to nvim
#57
when telescope shows, read content in register
*
and+
and storagewhen delete, remove them and cleanup register
*
and*