Skip to content

Commit

Permalink
Saturday 2024-11-16 20:16:01
Browse files Browse the repository at this point in the history
  • Loading branch information
jackokring committed Nov 16, 2024
1 parent 07d0238 commit cdbff26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
23 changes: 6 additions & 17 deletions lua/doris.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ local cm = require("plenary.context_manager")
_G.fn = vim.fn
---looks more C like
_G.ap = vim.api
local co = coroutine

---unicode num cast
---@param c string
Expand All @@ -36,23 +35,13 @@ end
_G.chr = function(n)
return fn.nr2char(n, true)
end
---blank callback no operation
local nop = function() end

---@class DorisModule
local M = {}

-- function import and pass export
-- from doris module
-- only pure functions not needing vim calls
---@type fun():nil
_G.nop = nop
---wrap a yielding function as an iterator
_G.wrap = co.wrap
---coroutine yeild within a function
_G.yield = co.yield
---make a producer which can send and even receive, from an anonymous function
-- then from plenary modules
-- promises/futures async
-- imports async/await into _G
_G.void = as.void
Expand Down Expand Up @@ -117,12 +106,6 @@ M.setup = function(args)
return M
end

-- impure commands (impure by virtue of command in plugin/doris.lua)
---@return table
M.doris = function()
return M.config.doris
end

-- impure function collection
-- notify defaults
-- notify status message
Expand Down Expand Up @@ -497,6 +480,12 @@ M.test_popup = function()
end, nop, nop)
end

-- impure commands (impure by virtue of command in plugin/doris.lua)
---@return table
M.doris = function()
return M.config.doris
end

-- clean up
novaride.restore()
return M
7 changes: 7 additions & 0 deletions lua/doris/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
-- everything is independant of nvim
local novaride = require("doris.novaride").setup()

---blank callback no operation
_G.nop = function() end
---insert into table
_G.insert = table.insert
---concat table
Expand Down Expand Up @@ -517,6 +519,11 @@ end

local co = coroutine

---wrap a yielding function as an iterator
_G.wrap = co.wrap
---coroutine yeild within a function
_G.yield = co.yield

---construct a producer function which can use send(x)
---and receive(producer: thread) using the supply chain
---@param fn fun(chain: unknown): nil
Expand Down

0 comments on commit cdbff26

Please sign in to comment.