mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2024-12-28 08:29:15 -06:00
Compare commits
2 Commits
45af52ce2c
...
fb183bf479
Author | SHA1 | Date | |
---|---|---|---|
|
fb183bf479 | ||
|
c54176b532 |
@ -172,13 +172,8 @@ end
|
||||
|
||||
--- Do general plugin setup
|
||||
---@param opts nvim-ts-autotag.PluginSetup?
|
||||
function Setup.setup(config)
|
||||
if config then
|
||||
Setup.opts = config.opts
|
||||
opts = Setup.opts
|
||||
else
|
||||
opts = {}
|
||||
end
|
||||
function Setup.setup(opts)
|
||||
opts = opts or {}
|
||||
if Setup.did_setup() then
|
||||
return
|
||||
end
|
||||
@ -243,4 +238,8 @@ function Setup.get_opts(filetype)
|
||||
return Setup.opts
|
||||
end
|
||||
|
||||
|
||||
function Setup.toggle()
|
||||
Setup.get_opts().enable = not Setup.get_opts().enable
|
||||
end
|
||||
return Setup
|
||||
|
@ -470,6 +470,11 @@ 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()
|
||||
@ -576,11 +581,13 @@ function M.buffers()
|
||||
end
|
||||
|
||||
M.toggle = function()
|
||||
Setup.opts.enable = not Setup.opts.enable
|
||||
if Setup.opts.enable then
|
||||
Setup.toggle()
|
||||
if Setup.get_opts().enable then
|
||||
M.enable()
|
||||
vim.notify('autotag toggled on')
|
||||
else
|
||||
M.disable()
|
||||
vim.notify('autotag toggled off')
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user