-
-
Notifications
You must be signed in to change notification settings - Fork 618
TextYankPost not setting v:event key regcontents (nor any other keys for TextYankPost) #2535
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Many thanks for the detailed investigation and report. It appears that we do need to populate all the things. We can hardcode most of it, perhaps something like: {
inclusive = false,
operator = "y",
regcontents = { "$FOOBAR" },
regname = "", --unnamed
regtype = "v", --we're not yanking the whole line
visual = false
} I'd be most grateful if you could submit a PR @aalvarado1919 - you have all the knowledge and a good test setup... |
Yes, I can take a look this week @alex-courtis. |
I don't actually know how I would set the v:event variable. Seems to be readonly and trying to pass any arguments to
Did not seem to work. I've asked a question on SO here. If I can get an answer, I will be able to create the PR |
According to help:
event "sets it", not consumers. Confirmed with: vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.print(vim.v.event)
end,
}) and yanking in regular buffer, this will print: {
inclusive = true,
operator = "y",
regcontents = { "ction(event)" },
regname = "",
regtype = "v",
visual = false
} Yanking vim.empty_dict() That explains reported error. Issue explained by this line of help quoted above:
and that's exactly what nvim-tree does: |
I wonder if |
@gegoune Had to set with
but that still does not fire the TextYankPost autocmd on its own |
I also encountered the same problem. I did some investigation and I believe currently there is no way to trigger TextYankPost with custom v:event without internal change of vim since both :doautocmd and nvim_exec_autocmds() just use empty v:event. I think it is reasonable to make :doautocmd accept custom v:event. I will see whether I can make an PR for this to vim. I think currently our best solution we can have is to write the content somewhere and use vim command to do real copy then delete those text. |
Description
I have a separate plugin (neoclip), which listens to TextYankPost events.
When the handler is run in neoclip, it requires regcontents to be set. neoclip code
However, looking at the nvim-tree code
It doesn't seem to set those values that are documented for the TextYankPost event.
Neovim version
Operating system and version
macOS 13.6.2
Windows variant
No response
nvim-tree version
80cfead
Clean room replication
Steps to reproduce
Expected behavior
Open nvim-tree, for a file in the tree, try to yank the filename with 'y'. There are no error messages that show up for handlers that read regcontents from the event.
Actual behavior
Open nvim-tree, for a file in the tree, try to yank the filename with 'y'.
The text was updated successfully, but these errors were encountered: