From b282e76be4606d9f2fecc06d2dc8e58d5e3514be Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 24 Jun 2023 15:15:50 -0600 Subject: [PATCH] fix: gq with null-ls --- modules/common/neovim/config/lsp.nix | 7 +++++++ 1 file changed, 7 insertions(+) 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, })