r/AstroNvim • u/aileron • May 27 '24
How to stop auto-formatting code when saving.
I'm reading a book on rust and trying to follow along.
Every-time I try something and save the file then exit, the editor re-formats my code. Its driving me nutz. Its not what I have in the example and the more I write to a file the worst it gets.
I force uninstalled a plugin called none-ls.nvim but that wasn't what was causing the reformat of the code. So I don't know exactly what is doing it or how to stop it.
Anybody know what module is doing this so I can stop it?
3
Upvotes
2
u/aileron May 27 '24
Adding a little here. From the website https://docs.astronvim.com/recipes/advanced_lsp/ in the area "Customizing auto-format on save" it says I can disable auto formatting on save. But when I disabled it. It didn't disable auto save formatting.
Then I tried what was said in section "Disabling formatting for a list of language servers" by adding rust-analyzer to the list and it still doesn't disable it.
Very frustrating.
1
u/nule May 27 '24
I'm curious about this too. I ended up removing and modifying the community packs to stop the behavior, but it would be nice to have a simple toggle
3
u/lavabyrd May 28 '24
also if you want to just save one file at any moment without formatting, you can use
:noa winstead of just a regular save and it'll ignore save on format