feat: allow to be lazy loaded on InsertEnter (#212)

This commit is contained in:
Lopy 2024-08-27 17:42:20 -05:00 committed by GitHub
parent 0cb76eea80
commit e239a560f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -187,6 +187,13 @@ function Setup.setup(opts)
TagConfigs:add_alias(new_ft, existing_ft)
end
local augroup = vim.api.nvim_create_augroup("nvim_ts_xmltag", { clear = true })
vim.api.nvim_create_autocmd("InsertEnter", {
group = augroup,
once = true,
callback = function(args)
require("nvim-ts-autotag.internal").attach(args.buf)
end,
})
vim.api.nvim_create_autocmd("Filetype", {
group = augroup,
callback = function(args)

View File

@ -445,6 +445,9 @@ end
M.attach = function(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
if buffer_tag[bufnr] then
return
end
---@diagnostic disable-next-line: invisible
if not Setup.did_setup() then
local _, ts_configs = pcall(require, "nvim-treesitter.configs")