I am happy to work on this if it is desired. I want to find out if this change would be welcome in Vim.
Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
Yes. It is currently impossible to detect changes on registers. There are many things within vim that will modify the registers. However, there is no way of telling when a register got modified. It is possible to set up a complex series of autocmds and keymaps to get close, but you still cannot get all the way there.
A clear and concise description of what is hard to do
It is hard to display the contents of a register on the screen and update that display as the register changes.
Describe the solution you'd like
I would like to have a RegisterChanged event that includes some information in v:event about what register changed and what its new (and old?) contents are(/were?).
Describe alternatives you've considered
There is no currently viable workaround. I can't think of any good alternatives other than some kind of autocmd event. For now, the only solution is to accept that detecting changes on some registers is not possible and that any kind of on-screen register display will not always be up to date for various reasons.
Additional context
This plugin is an example of a case where I would love to have this feature.
I also experimented with implementation of this already, but I want to check here before I go any further.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Hi, thanks. We already have a few listener_...() functions, that register a callback when a buffer changes.
So I am wondering if it wouldn't make sense to rather have a listener_expr_add() function that registers a callback whenever an expression changes? This would be more useful and could also be used whenever a variable or register changes?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I agree that would be an even more generically useful feature. However, I don't know how that would be implemented. How would you specify the "expr" (or register or variable) in the _add() function? I think a truly generic listener on any variable would be very difficult to implement, no?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@nullromo Are you working on this feature? If not I would be glad to try giving it a shot. The use case I am thinking of is that with the RegisterChanged and TextYankPost events, a way to implement a custom clipboard can be done in Vim. We already have the clipmethod option, so a new value like dummy can be added to it which allows the + and * registers to be modified by the user, essentially making it like any other register.
Thanks,
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@64-bitman I was more just waiting on a more clear idea about
if this change would be welcome in Vim
I didn't want to do a bunch of work on it only to find that it's not really the right direction. But if so then I do want to work on it.
@chrisbra would you say go for it or should we try to get some more input from others? Or maybe the requirements/details need to be defined a little more, which I can also work on as well.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.