mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2025-01-01 13:59:13 -06:00
fix: allow disable
This commit is contained in:
parent
e254b306fb
commit
6be1192965
@ -87,10 +87,12 @@ local skip_tags = {
|
||||
### Override default values
|
||||
|
||||
``` lua
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
autotag = {
|
||||
enable = true,
|
||||
enable_rename = true,
|
||||
enable_close = true,
|
||||
enable_close_on_slash = true,
|
||||
filetypes = { "html" , "xml" },
|
||||
}
|
||||
}
|
||||
|
@ -105,8 +105,15 @@ M.setup = function(opts)
|
||||
opts = opts or {}
|
||||
M.tbl_filetypes = opts.filetypes or M.tbl_filetypes
|
||||
M.tbl_skipTag = opts.skip_tag or M.tbl_skipTag
|
||||
M.enable_rename = opts.enable_rename or M.enable_rename
|
||||
M.enable_close = opts.enable_close or M.enable_close
|
||||
if opts.enable_rename ~= nil then
|
||||
M.enable_rename = opts.enable_rename
|
||||
end
|
||||
if opts.enable_close then
|
||||
M.enable_close = opts.enable_close
|
||||
end
|
||||
if opts.enable_close_on_slash ~= nil then
|
||||
M.enable_close_on_slash = opts.enable_close_on_slash
|
||||
end
|
||||
end
|
||||
|
||||
local function is_in_table(tbl, val)
|
||||
@ -576,6 +583,7 @@ M.attach = function(bufnr, lang)
|
||||
M.lang = lang
|
||||
local config = configs.get_module("autotag")
|
||||
M.setup(config)
|
||||
|
||||
if is_in_table(M.tbl_filetypes, vim.bo.filetype) then
|
||||
setup_ts_tag()
|
||||
if M.enable_close == true then
|
||||
|
Loading…
Reference in New Issue
Block a user