ts-autotag fixed
This commit is contained in:
		
							parent
							
								
									87857e4028
								
							
						
					
					
						commit
						3d397d3d05
					
				| 
						 | 
				
			
			@ -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())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 </
 | 
			
		||||
        },
 | 
			
		||||
        -- Also override individual filetype configs, these take priority.
 | 
			
		||||
        -- Empty by default, useful if one of the "opts" global settings
 | 
			
		||||
        -- doesn't work well in a specific filetype
 | 
			
		||||
        per_filetype = {
 | 
			
		||||
          ['html'] = {
 | 
			
		||||
            enable_close = false,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      -- There are additional nvim-treesitter modules that you can use to interact
 | 
			
		||||
      -- with nvim-treesitter. You should go explore a few and see what interests you:
 | 
			
		||||
      --
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,46 +0,0 @@
 | 
			
		|||
return {
 | 
			
		||||
  'windwp/nvim-ts-autotag',
 | 
			
		||||
  config = function()
 | 
			
		||||
    local options = {
 | 
			
		||||
      auto_install = true,
 | 
			
		||||
      ensure_installed = {
 | 
			
		||||
        'lua',
 | 
			
		||||
        'vim',
 | 
			
		||||
        'go',
 | 
			
		||||
        'toml',
 | 
			
		||||
        'css',
 | 
			
		||||
        'tsx',
 | 
			
		||||
        'css',
 | 
			
		||||
        'html',
 | 
			
		||||
        'lua',
 | 
			
		||||
      },
 | 
			
		||||
      highlight = {
 | 
			
		||||
        enable = true,
 | 
			
		||||
        use_languagetree = true,
 | 
			
		||||
      },
 | 
			
		||||
      autotag = {
 | 
			
		||||
        enable = true,
 | 
			
		||||
        filetypes = {
 | 
			
		||||
          'html',
 | 
			
		||||
          'javascript',
 | 
			
		||||
          'typescript',
 | 
			
		||||
          'javascriptreact',
 | 
			
		||||
          'typescriptreact',
 | 
			
		||||
          'svelte',
 | 
			
		||||
          'vue',
 | 
			
		||||
          'tsx',
 | 
			
		||||
          'jsx',
 | 
			
		||||
          'rescript',
 | 
			
		||||
          'css',
 | 
			
		||||
          'lua',
 | 
			
		||||
          'xml',
 | 
			
		||||
          'php',
 | 
			
		||||
          'markdown',
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
      indent = { enable = true },
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    require('nvim-treesitter.configs').setup(options)
 | 
			
		||||
  end,
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue