I run an autocmd to format before saving (see below) but when I am in none lsp supported files I get notifications that no formatter is available (using nvim-notify). Is there a way to not make this notification appear?
Thanks for your answer! I do all my formatting with null-ls so I found this solution:
vim.api.nvim_create_autocmd("BufWritePre", {
callback = function()
-- check if null-ls exists
local check, nullls = pcall(require, "null-ls")
-- check if a formatting source of null-ls is registered
if check and nullls.is_registered({ method = nullls.methods.FORMATTING }) then
vim.lsp.buf.format()
else
vim.cmd([[normal gg=G<C-o>]])
end
end,
})