> register_cfunc is generic enough to also work for python and ruby which would allow those languages to also extend if needed using this same mechanism. Else one would need to create global functions in vimscript and then use vim.funcref which isn't ideal.
That's interesting. I don't use the lua interface, but YCM and Vimspector both make heavy use of the embedded python3, i have been thinking about exposing job and channel objects to the python layer. But it sounds like you've gone a different way here with lua. Would you mind elaborating on how that mechanism would work ? Are you saying you'd be able to do the equivalent of vim.eval ( 'job_start' .... ) and pass a Python function as the, say 'out_cb' (as opposed to a vimscript function which then does a ':py3' to call back into python ? {on an unrelated note, i suspect that even then this wouldn't work in neovim as neovim's python implementation is totally different and already divergently incompatible with vim, but that's another story for another place} On Thursday, June 18, 2020 at 12:38:12 AM UTC+1, Prabir Shrestha wrote: > > My current use case was to rewrite asyncomplete > <https://github.com/prabirshrestha/asyncomplete.vim> v3 in both vimscript > (for older version and backwards compatibility) and lua (for performance). > I need to use timers and jobs to pass functions as well as pass the > autocomplete callback functions around hence the main reason behind this > PR. My first comment in the PR included timer examples as I need it to > debounce on keystrokes. There are also some parts of vim-lsp > <https://github.com/prabirshrestha/vim-lsp> I would like to write in lua > for perf reasons. There are also other plugins I would like to write in > pure lua that uses jobs. It is also lot easier to work with lua closures > that is multiline and contains if else than vimscript. > > I have tried several times in the past few years to write lua plugins but > always landed up with vimscript because the integration was ugly since > there is no good bindings. It felt that lua was more there just for the > sake of it rather than creating real plugins. Given that I had so hard time > creating lua plugins I definitely understand why there are very few to > almost none lua plugins for vim. > > Next version of neovim 0.5 is going to ship with LSP protocol by default > which is written in lua and as part of that work they have already gone and > added these apis so an entire full fledged powerful plugin can be created > in lua. In the past few months I have also seen rise of neovim plugins > written in pure lua and I expect this to continue to rise once v0.5 ships. > > register_cfunc is generic enough to also work for python and ruby which > would allow those languages to also extend if needed using this same > mechanism. Else one would need to create global functions in vimscript and > then use vim.funcref which isn't ideal. > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/vim/vim/pull/6246#issuecomment-645681327>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACY5DGCE7U547U2RIQYBUSTRXFHV3ANCNFSM4N4AMEUA> > . > -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/d0b6fba7-c2cc-4016-8c7f-7803a1dfb16fo%40googlegroups.com.