From 3d397d3d050b09c94cecdce668ac5e6889e82c7e Mon Sep 17 00:00:00 2001 From: Sarjyant Date: Wed, 18 Sep 2024 06:30:46 +0545 Subject: [PATCH] ts-autotag fixed --- lua/custom/plugins/autopairs.lua | 9 +++--- lua/custom/plugins/conform.lua | 6 ++-- lua/custom/plugins/treesitter.lua | 20 ++++++++++++++ lua/custom/plugins/ts-autotag.lua | 46 ------------------------------- 4 files changed, 29 insertions(+), 52 deletions(-) delete mode 100644 lua/custom/plugins/ts-autotag.lua diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua index 6a9e751e..e2cf4a31 100644 --- a/lua/custom/plugins/autopairs.lua +++ b/lua/custom/plugins/autopairs.lua @@ -2,11 +2,12 @@ return { 'windwp/nvim-autopairs', - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, + event = 'InsertEnter', + -- config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function + opts = {}, config = function() - require('nvim-autopairs').setup {} - -- If you want to automatically add `(` after selecting a function or method local cmp_autopairs = require 'nvim-autopairs.completion.cmp' local cmp = require 'cmp' cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) diff --git a/lua/custom/plugins/conform.lua b/lua/custom/plugins/conform.lua index 67cfd153..681e7990 100644 --- a/lua/custom/plugins/conform.lua +++ b/lua/custom/plugins/conform.lua @@ -19,10 +19,12 @@ return { return { 'isort', 'black' } end end, - javascript = { { 'prettierd', 'prettier' } }, - javascriptreact = { { 'prettierd', 'prettier' } }, + -- Replace nested brackets with separate formatters and `stop_after_first` + javascript = { 'prettierd', 'prettier' }, + javascriptreact = { 'prettierd', 'prettier' }, ['*'] = { 'trim_whitespace' }, }, + -- stop_after_first = true, }, }, } diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua index fa984a26..63666804 100644 --- a/lua/custom/plugins/treesitter.lua +++ b/lua/custom/plugins/treesitter.lua @@ -2,6 +2,9 @@ return { { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', + dependencies = { + 'windwp/nvim-ts-autotag', + }, config = function() -- [[ Configure Treesitter ]] See `:help nvim-treesitter` @@ -14,6 +17,23 @@ return { indent = { enable = true }, } + require('nvim-ts-autotag').setup { + opts = { + -- Defaults + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false, -- Auto close on trailing