4

I am a new user to neovim, and a moderator on this site said

You seem to imply that you expect there should be a native way to run [filetype] (and to some extent every Ex command) directly in Lua. But that's really not the case.

That's a fair point. I did assume and expect the Lua API to provide full support for everything you could do in Ex. If that not the case, should a lack of functionality in Lua be looked at is a part of the design, or merely things that yet need to be done. Is there a document on Lua in VIM and the design goals or a post on the mailing list detailing this?

1 Answer 1

4

The point of Lua support in NeoVim is not really to replace Ex commands altogether. That wouldn't really be possible (consider commands like :e or :w or :s etc.) or productive. Instead, the point of Lua in NeoVim is to replace Ex commands (and Vimscript to some extent) as the only or main language in which to write plug-ins for NeoVim.

So while rewriting Vimscript plug-ins in Lua makes a lot of sense (and is likely to produce performance and usability gains), there's not really a lot of value in rewriting your configuration in Lua. Even if you do, you're likely to end up using quite a few Ex commands in that, so use of vim.cmd() and friends is the way to go there.

1
  • 1
    I would love to know why there isn't a nvim_write_buf(handle) api call in Lua. If by design, that seems weird. There is an nvim_list_bufs() Commented Apr 7, 2022 at 2:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.