local M = {} ---@param str string ---@param hl string|rc.Highlight ---@return string function M.with_hl(str, hl) return "%#" .. (type(hl) == "string" and hl or hl.name) .. "#" .. str .. "%*" end do ---@package M._funcs = {} local funcs_count = 0 local modname = ... ---@param func fun(): string ---@param args? string ---@return string function M.as_opt(func, args) local idx ---@type string if M._funcs[func] then idx = M._funcs[func] else funcs_count = funcs_count + 1 idx = "n" .. funcs_count M._funcs[idx] = func M._funcs[func] = idx end args = args or "" return ("%%!v:lua.require'%s'._funcs.%s(%s)"):format(modname, idx, args) end end return M