Skip to content

Commit

Permalink
ref: adds config.options.supported_filetypes pattern to autocmds
Browse files Browse the repository at this point in the history
  • Loading branch information
catgoose committed Apr 25, 2024
1 parent 9b92719 commit 0019e2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/tailwind-tools/conceal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ end
M.enable = function()
vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI" }, {
group = vim.g.tailwind_tools.conceal_au,
pattern = config.options.supported_filetypes,
callback = function(args) set_conceal(args.buf) end,
})
-- Workaround to reset conceallevel per buffer
vim.api.nvim_create_autocmd("BufEnter", {
group = vim.g.tailwind_tools.conceal_au,
pattern = config.options.supported_filetypes,
callback = function(args)
vim.wo.conceallevel = vim.opt.conceallevel:get()
if state.conceal.enabled then set_conceal(args.buf) end
Expand All @@ -60,6 +62,7 @@ end
M.disable = function()
vim.wo.conceallevel = 0
vim.api.nvim_clear_autocmds({
pattern = config.options.supported_filetypes,
group = vim.g.tailwind_tools.conceal_au,
event = { "TextChanged", "TextChangedI" },
})
Expand Down
1 change: 1 addition & 0 deletions lua/tailwind-tools/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ M.setup = function(options)

vim.api.nvim_create_autocmd("LspAttach", {
group = vim.g.tailwind_tools.conceal_au,
pattern = config.options.supported_filetypes,
callback = lsp.on_attach,
})

Expand Down

0 comments on commit 0019e2f

Please sign in to comment.