Hi, On Tue, Jan 24, 2023 at 7:12 PM Geoff Reedy <[email protected]> wrote:
> I think it would be neat to allow a funcref in autocmd_add and add a > callback_T cmd_cb field to the auto command struct for it. > > The same would be nice for options like omnifunc. Interestingly these are > stored into the buffer structure as callback objects but only set as > strings. > You can set 'omnifunc' and other similar '*func' options to a funcref. You can refer to the following help topic: https://vimhelp.org/options.txt.html#option-value-function The following commit added this support: https://github.com/vim/vim/commit/8658c759f05b317707d56e3b65a5ef63930c7498 - Yegappan > I started working on a patch to allow a funcref as the cmd option in > autocmd_add but ran into a conceptual limitation: these places cannot be > extended to hold funcrefs without slightly breaking compatibility. There > are potentially scripts that rely on the fact that these values are > accessed as strings. Now the common pattern of saving an option value and > then restoring it should work the same (except if it is a vim9 script that > is using the string type for the variable) and autocmd_get is only since > vim9 so maybe this slight incompatibility is acceptable. > > > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7m2HY-Mdo92_hfchfX%3D-iNkw3UA8vNCKYvU0pfNAcnN3A%40mail.gmail.com.
