windwp / nvim-ts-autotag

Use treesitter to auto close and auto rename html tag
MIT License
1.65k stars 87 forks source link

Auto indent #197

Closed xndrpr closed 3 months ago

xndrpr commented 3 months ago

Hi. Is it possible to auto indent?

This is what I get:

<div>
|</div>

but I'd like to have this:

<div>
    |
</div>

My config(lazy.nvim):

return {
  {
    "nvim-ts-autotag",
    config = function()
      require("nvim-ts-autotag").setup {
        opts = {
          enable_close = true,
          enable_rename = true,
          enable_close_on_slash = false,
        },
       per_filetype = {
          ["html"] = {
            enable_close = false,
          },
        },
      }
    end,
  },
  {
    "nvim-t reesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
      local configs = require "nvim-treesitter.configs"

      configs.setup {
        auto_install = true,
        sync_install = false,
        highlight = {
          enable = true,
        },
        indent = {
          enable = true,
        },
      }
    end,
  },
}
xndrpr commented 3 months ago

Just found a solution:

  {
    "windwp/nvim-autopairs",
    event = "InsertEnter",
    config = true,
  },

duplicate of #24