I was researching a way to use Neovim's remote plugin protocol to support a plugin to interact with Supabase Realtime messages (which sadly don't appear to have a Lua library yet) when I came across nvim_oxi. Dodging around the remote plugin API, it instead exposes bindings directly to Neovim's C API.
This of course introduces the possibility of ABI incompatibility (Neovim's ABI might change with a
new release) so each version is pinned to an nvim
version, and a target must be selected to choose
which nvim
you're building for.
Getting things started is a little fiddly at first. It turns out the name of the entrypoint and the name of the library have to match exactly, but once you get past that you can call Rust functions from Lua without a care in the world!
#[nvim_oxi::plugin]
fn supabase_nvim() -> String {
"Yup".into()
}
I'm not saying I'd write every, or even many plugins in Rust, but it's great to have the option for moments like these where I have existing code supporting my Twitch stream overlay and I just need a way for Neovim to talk to it.
New toy! Next stop:
:StreamCommand raid WardstoneStudio