windwp / nvim-ts-autotag

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

feat: add auto indenting and moving closing tag to line below #155

Closed AnthonyPoschen closed 5 months ago

AnthonyPoschen commented 6 months ago

when pressing it will do the following right after making a tag pair.

<div>|</div>
on <CR> becomes
<div>
  |
</div>

https://github.com/windwp/nvim-ts-autotag/assets/2253299/c66e12bc-058a-4016-a43e-809cf6877a5f

AnthonyPoschen commented 5 months ago

i am not loving this. the indenting function occuring at times it shouldn't i think its because of the way the regex is matching, i kept to the existing function and replicated for the other direction. Maybe i was doing it wrong?

Thus pressing enter in the right places constantly will insert blank lines below repeatedly.

windwp commented 5 months ago

sorry the <CR> will use an mapping from nvim-autopairs.

the indent is working for me on html with nvim-autopairs and autotag. so if you have wrong indent on another filetype . check indent config from that file type