Here is something that has been weirding me out since Lua was added: why do API functions still have their nvim_
prefix? I have to write vim.api.nvim_feedkeys
instead of simply vim.api.feedkeys
. It’s not a big deal, I just want to know the reasoning.
Hello! The reason is because neovim API is written in C following the nvim_
naming convention. And is not only exposed to Lua, is also exposed to VimL and any of the many RPC clients.
So the api is exposed fully without modifications to adapt to Lua in the vim.api
“namespace”.
Now that Lua is evolving in neovim you will start to see more function that are more “Lua like” that handle calling the api for you, for example vim.region
.
2 Likes