diff --git a/modules/common/neovim/config/lsp.nix b/modules/common/neovim/config/lsp.nix index 53d4052..3cca40e 100644 --- a/modules/common/neovim/config/lsp.nix +++ b/modules/common/neovim/config/lsp.nix @@ -50,6 +50,7 @@ on_attach = function(client, bufnr) if client.supports_method("textDocument/formatting") then + -- Auto-format on save vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) vim.api.nvim_create_autocmd("BufWritePre", { group = augroup, @@ -58,6 +59,12 @@ vim.lsp.buf.format({ bufnr = bufnr }) end, }) + -- Use internal formatting for bindings like gq. + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + vim.bo[args.buf].formatexpr = nil + end, + }) end end, })