mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2024-12-28 20:09:15 -06:00
feat: allow to be lazy loaded on InsertEnter (#212)
This commit is contained in:
parent
0cb76eea80
commit
e239a560f3
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user