diff --git a/lua/nvim-ts-autotag/internal.lua b/lua/nvim-ts-autotag/internal.lua index a961bf3..2f2b236 100644 --- a/lua/nvim-ts-autotag/internal.lua +++ b/lua/nvim-ts-autotag/internal.lua @@ -38,13 +38,15 @@ local JSX_TAG = { } -M.enableRename = true -M.enableClose = true +M.enable_rename = true +M.enable_close = true 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 end local function is_in_table(tbl, val) @@ -314,14 +316,16 @@ M.attach = function (bufnr) local config = configs.get_module('autotag') M.setup(config) if is_in_table(M.tbl_filetypes, vim.bo.filetype) then - vim.cmd[[inoremap > >:lua require('nvim-ts-autotag.internal').closeTag()a]] - bufnr = bufnr or vim.api.nvim_get_current_buf() - if M.enableRename == true then - vim.cmd("augroup nvim_ts_xmltag_" .. bufnr) - vim.cmd[[autocmd!]] - vim.cmd[[autocmd InsertLeave call v:lua.require('nvim-ts-autotag.internal').renameTag() ]] - vim.cmd[[augroup end]] - end + if M.enable_close == true then + vim.cmd[[inoremap > >:lua require('nvim-ts-autotag.internal').closeTag()a]] + end + if M.enable_rename == true then + bufnr = bufnr or vim.api.nvim_get_current_buf() + vim.cmd("augroup nvim_ts_xmltag_" .. bufnr) + vim.cmd[[autocmd!]] + vim.cmd[[autocmd InsertLeave call v:lua.require('nvim-ts-autotag.internal').renameTag() ]] + vim.cmd[[augroup end]] + end end end diff --git a/tests/closetag_spec.lua b/tests/closetag_spec.lua index 3264508..0aaa933 100644 --- a/tests/closetag_spec.lua +++ b/tests/closetag_spec.lua @@ -173,7 +173,6 @@ for _, value in pairs(data) do end if #run_data == 0 then run_data = data end local autotag = require('nvim-ts-autotag') -autotag.test = true autotag.enableRename = false local _, ts_utils = pcall(require, 'nvim-treesitter.ts_utils')