Skip to content

Commit

Permalink
fix(autocommands): pass augroup correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
champignoom committed Jan 2, 2024
1 parent ae38baf commit 52de5cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/neorg/modules/core/autocommands/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,25 @@ module.public = {
autocmd = autocmd:lower()
local subscribed_autocommand = module.events.subscribed["core.autocommands"][autocmd]

if subscribed_autocommand ~= nil then
vim.cmd("augroup Neorg")
local group = vim.api.nvim_create_augroup("Neorg", { clear = false })

if subscribed_autocommand ~= nil then
if dont_isolate and vim.fn.exists("#Neorg#" .. autocmd .. "#*") == 0 then
vim.api.nvim_create_autocmd(autocmd, {
group = group,
callback = function(ev)
_neorg_module_autocommand_triggered("core.autocommands.events." .. autocmd, false, ev)
end,
})
elseif vim.fn.exists("#Neorg#" .. autocmd .. "#*.norg") == 0 then
vim.api.nvim_create_autocmd(autocmd, {
pattern = "*.norg",
group = group,
callback = function(ev)
_neorg_module_autocommand_triggered("core.autocommands.events." .. autocmd, true, ev)
end,
})
end
vim.cmd("augroup END")
module.events.subscribed["core.autocommands"][autocmd] = true
end
end,
Expand Down

0 comments on commit 52de5cf

Please sign in to comment.