nvim-lua / plenary.nvim

plenary: full; complete; entire; absolute; unqualified. All the lua functions I don't want to write twice.
MIT License
2.69k stars 284 forks source link

Simple example for async #574

Open daniilrozanov opened 5 months ago

daniilrozanov commented 5 months ago

I am writing a plugin, which needs to do some i/o jobs on setup and later. So i want to to all of this async and without callbacks. Is there some simple example from scratch, which explains how to organise all this calls, starting from setup function?

In readme you give example of async reading like

local a = require "plenary.async"
local read_file = function(path)
-- ...

But it is not obvious, from which context i should invoke it. All i doing now is reading telescope and neotree sources to figure out how to use it, but it's hard way, i would prefer some more simple project to research.