Skip to content

Commit

Permalink
fix executing multiple time
Browse files Browse the repository at this point in the history
  • Loading branch information
cappyzawa committed Aug 28, 2021
1 parent 3617800 commit bd15652
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/trim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ M.setup = function(cfg)
if not cfg.disable then
vim.cmd [[ autocmd BufWritePre * Trim]]
else
local disables = {}
for _, v in pairs(config.disable) do
vim.cmd (string.format(" autocmd BufWritePre * if &filetype != '%s' | Trim", v))
table.insert(disables, string.format("&filetype != '%s'", v))
end
vim.cmd (string.format(" autocmd BufWritePre * if %s | Trim", table.concat(disables, " && ")))
end
vim.cmd [[augroup END]]
end
Expand Down

0 comments on commit bd15652

Please sign in to comment.