this post was submitted on 26 Feb 2025
10 points (100.0% liked)

Neovim

2319 readers
3 users here now

founded 2 years ago
MODERATORS
 

(Linked video showcases issue quite clearly)

I am using AstroNvim, but I believe that doesn't matter too much in this instance

I am very much new to html and js and the stuffs - but this tag indenting is catching me very offguard.
When I type a new tag it gets indented all nicely, and when opening a new line with o or O key, it nicely puts an indent if I am already in another tag. But when I then save with :w or ZZ, it reformats the indenting again... I think this might be two formatting agents fighting one another with different goals to format the xml tag indenting?

I installed node with npm, as it kinda seems that that is a requirement for working with html stuffs smoothly... and I installed some Lsp and ... stuffs with TsInstall and LspInstall and such... but I would expect those to not change formatting like this.

Has someone here experienced a similar issue? Is nvim in general maybe not the best for webdev? My friend uses brackets, which seems FOSS, but windows only >;(
Until recently, I mostly used nvim only for editing basic json and GDScript files, sometimes some cpp code even, and that worked great so far.

you are viewing a single comment's thread
view the rest of the comments
[–] someacnt 1 points 1 day ago

Do you know which formatters you installed? Does the LSP have a formatting capability?

IIRC some extensions simply "guess" indentations, and some formatters format the file on save. That might be what's happening here.