mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-04 18:50:05 +08:00
16 lines
337 B
Lua
16 lines
337 B
Lua
|
local a = require "plenary.async_lib.async"
|
||
|
local async, await = a.async, a.await
|
||
|
|
||
|
return setmetatable({}, {
|
||
|
__index = function(t, k)
|
||
|
return async(function(...)
|
||
|
-- if we are in a fast event await the scheduler
|
||
|
if vim.in_fast_event() then
|
||
|
await(a.scheduler())
|
||
|
end
|
||
|
|
||
|
vim.api[k](...)
|
||
|
end)
|
||
|
end,
|
||
|
})
|