On LazyVim when I save a cpp file it is automatically formatted.
It is possible to disable/enable it in the session using Spaceuf
But I would like to disable that autoformatting on save functionality by default.
How to do that?
I received a warning using the above answer. Looks like it should be set in
~/.config/nvim/lua/config/options.lua
vim.g.autoformat = false
nvim-lspconfig.opts.autoformat
is deprecated. Please use vim.g.autoformat
instead # stacktrace: - /LazyVim/lua/lazyvim/util/plugin.lua:93 in **** - vim/_editor.lua:0
Commented
Dec 21, 2023 at 2:05
lua vim.g.autoformat = false
.
The auto-formatting on save is a LazyVim functionality associated to the nvim-lspconfig
plugin.
To disable it you have to create a lua file in ~/.config/nvim/lua/plugins
folder with the following content:
~/.config/nvim/lua/plugins/lazyvim.lua
return {
{
"neovim/nvim-lspconfig",
opts = {
autoformat = false,
},
},
}