You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: lua/neorg/modules/core/neorgcmd/module.lua
+72-4
Original file line number
Diff line number
Diff line change
@@ -121,16 +121,28 @@ module.config.public = {
121
121
--
122
122
-- This feature will soon be deprecated, so it is not recommended to touch it.
123
123
default= {
124
-
"module.list",
125
-
"module.load",
126
124
"return",
127
125
},
128
126
}
129
127
130
128
---@classcore.neorgcmd
131
129
module.public= {
132
130
-- The table containing all the functions. This can get a tad complex so I recommend you read the wiki entry
133
-
neorg_commands= {},
131
+
neorg_commands= {
132
+
module= {
133
+
subcommands= {
134
+
load= {
135
+
args=1,
136
+
name="module.load",
137
+
},
138
+
139
+
list= {
140
+
args=0,
141
+
name="module.list",
142
+
},
143
+
},
144
+
},
145
+
},
134
146
135
147
--- Recursively merges the contents of the module's config.public.funtions table with core.neorgcmd's module.config.public.neorg_commands table.
136
148
---@parammodule_namestring #An absolute path to a loaded module with a module.config.public.neorg_commands table following a valid structure
@@ -233,7 +245,7 @@ module.private = {
233
245
return
234
246
elseifnotcheck_condition(ref.condition) then
235
247
log.error(
236
-
("Error when executing `:Neorg %s` - the command is currently disabled. Some commands will only become available under certain conditions!"):format(
248
+
("Error when executing `:Neorg %s` - the command is currently disabled. Some commands will only become available under certain conditions, e.g. being within a `.norg` file!"):format(
237
249
table.concat(vim.list_slice(args, 1, i), "")
238
250
)
239
251
)
@@ -421,4 +433,60 @@ module.private = {
421
433
422
434
module.neorg_post_load=module.public.sync
423
435
436
+
module.on_event=function(event)
437
+
ifevent.type=="core.neorgcmd.events.module.load" then
438
+
modules.load_module(event.content[1])
439
+
end
440
+
441
+
ifevent.type=="core.neorgcmd.events.module.list" then
442
+
ifnotneorg.modules.is_module_loaded("core.ui") then
443
+
log.error(":Neorg module list requires the `core.ui` module to be loaded!")
0 commit comments