stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
2.72k stars 142 forks source link

question: is there a way to disable autoformat on save in the current buffer? #374

Closed daniele821 closed 3 months ago

daniele821 commented 3 months ago

currently, i have stylua set as the formatter_by_ft for lua, and also have lsp_fallback enabled in format_on_save.

I sometimes do not want to format, thus i would like to disable formatting on save. But to do that, right now, i have to manually change the configuration and delete stylua in formatter_by_ft and set lsp_fallback in format_on_save as false.

Is there a way to disable all formatting on save happening in the current buffer?

If not, I think it would be a really useful feature

gegoune commented 3 months ago

:h noautocmd (use with w).

daniele821 commented 3 months ago

damn, i feel stupid now. I just spent hours trying to think about how to do that lol.

Altough i do would still like to have a way to temporarely disable formatting on save, thus allowing me to only write :w instead of :noautocmd w everytime i want to save. Especially since this disables all autocmd run with :w, i have other things which rely on that autocmd.

But yeah it's already a good partial fix to my problem. Thanks