Compare commits

..

1 Commits

Author SHA1 Message Date
fdgdgerg
45af52ce2c
Merge 36dbb20189 into 1cca23c9da 2024-12-17 16:23:22 -08:00
2 changed files with 9 additions and 15 deletions

View File

@ -172,8 +172,13 @@ end
--- Do general plugin setup
---@param opts nvim-ts-autotag.PluginSetup?
function Setup.setup(opts)
opts = opts or {}
function Setup.setup(config)
if config then
Setup.opts = config.opts
opts = Setup.opts
else
opts = {}
end
if Setup.did_setup() then
return
end
@ -238,8 +243,4 @@ function Setup.get_opts(filetype)
return Setup.opts
end
function Setup.toggle()
Setup.get_opts().enable = not Setup.get_opts().enable
end
return Setup

View File

@ -470,11 +470,6 @@ M.attach = function(bufnr)
if TagConfigs:get(vim.bo.filetype) ~= nil then
setup_ts_tag()
-- this uses a new instance of opts from a new call to Setup
-- vim.notify('function#if#if Setup.opts.enable: ' .. vim.inspect(Setup.opts)) -- __AUTO_GENERATED_PRINT_VAR_END__
if not Setup.get_opts().enable then
return
end
local group = vim.api.nvim_create_augroup("nvim-ts-autotag-" .. bufnr, { clear = true })
if Setup.get_opts(vim.bo.filetype).enable_close then
vim.keymap.set("i", ">", function()
@ -581,13 +576,11 @@ function M.buffers()
end
M.toggle = function()
Setup.toggle()
if Setup.get_opts().enable then
Setup.opts.enable = not Setup.opts.enable
if Setup.opts.enable then
M.enable()
vim.notify('autotag toggled on')
else
M.disable()
vim.notify('autotag toggled off')
end
end