Skip to content

Commit

Permalink
fix: fix file_patterns for autocmd BufWritePost
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Sep 18, 2022
1 parent 79133ab commit eb2bdbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/neoconf/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ function M.setup()
})

if Config.options.live_reload then
local group = vim.api.nvim_create_augroup("Settings", { clear = true })
local group = vim.api.nvim_create_augroup("Neoconf", { clear = true })
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = Util.file_patterns(),
pattern = Util.file_patterns({ autocmd = true }),
group = group,
callback = function(event)
local fname = Util.fqn(event.match)
Expand Down
8 changes: 8 additions & 0 deletions lua/neoconf/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ function M.file_patterns(opts)
end
end

if opts.autocmd then
for i, v in ipairs(ret) do
if v:find("/") then
ret[i] = "*/" .. v
end
end
end

return ret
end

Expand Down

0 comments on commit eb2bdbf

Please sign in to comment.