Send A Neovim Buffer Filepath To An External Process
Example from a neovim plugin
Code
local function export_to_file()
local Job = require 'plenary.job'
print("Exporting from: " .. vim.uri_from_bufnr(0))
Job:new({
command = 'grimoire_caster',
args = { '--action', 'export_file', '--path', vim.uri_from_bufnr(0) },
on_exit = function(job, return_val)
print(vim.inspect(job:result()))
end,
}):sync()
print("Exported from: " .. vim.uri_from_bufnr(0))
end
return {
export_to_file = export_to_file
}
In rust, that path has to be decoded with:
https://docs.rs/urlencoding/latest/urlencoding/index.html