Skip to content

Commit

Permalink
fix buffer autocommands bug? (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
m4cey authored Mar 4, 2024
1 parent 1b3aa90 commit 5867db9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lua/typst-preview/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,12 @@ end
---@param name string
---@param autocmds { event: string[]|string, opts: AutocmdOpts }[]
function M.create_autocmds(name, autocmds)
vim.defer_fn(function()
local id = vim.api.nvim_create_augroup(name, {})
for _, autocmd in ipairs(autocmds) do
---@diagnostic disable-next-line: inject-field
autocmd.opts.group = id
vim.api.nvim_create_autocmd(autocmd.event, autocmd.opts)
end
end, 0)
local id = vim.api.nvim_create_augroup(name, {})
for _, autocmd in ipairs(autocmds) do
---@diagnostic disable-next-line: inject-field
autocmd.opts.group = id
vim.api.nvim_create_autocmd(autocmd.event, autocmd.opts)
end
end

---print that can be called anywhere
Expand Down

0 comments on commit 5867db9

Please sign in to comment.