This is a thin layer over mlua to easily use the neovim api in rust.
Cargo new --lib (your-plugin-name)
cd (your-plugin-name)
cargo add --git https://github.com/norlock/neo-api-rs
Add crate-type in the Cargo.toml:
[lib]
crate-type = ["dylib"]
Create lua directory and symlink to it
mkdir lua
touch lua/(your-plugin-name).lua
cd lua
ln -s ../target/release/lib(your-plugin-name).so (your-plugin-name).so
Now to build:
Cargo build --release
There is an example you can follow on: nvim-traveller-rs
Basically you can write everything in Rust.
In lua file: (your-plugin-name).lua:
return require("your-plugin-name");
In your config point to your plugin (e.g. Lazy):
...
{ dir = '/path/to/nvim-traveller-rs' },
...
And to use:
local plugin_name = require('your-plugin-name')
vim.keymap.set('n', '<leader>p', plugin_name.some_function, {})
- Open preview at line buffer (maybe persist data between sessions)
- Implement grep search