From 398c2a82919e191b615bc8f7f14ae55d7413b288 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Mon, 30 Jun 2025 10:22:32 -0500 Subject: [PATCH] fix: formatexpr with lsp changed we need to adapt to it --- nix/base-system/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nix/base-system/init.lua b/nix/base-system/init.lua index 92b1f84..56ba4cd 100644 --- a/nix/base-system/init.lua +++ b/nix/base-system/init.lua @@ -20,6 +20,10 @@ vim.opt.fileformats = "unix,dos" -- Recommended by Avante docs -- views can only be fully collapsed with the global statusline vim.opt.laststatus = 3 +-- formatexpr defaulted to the lsp provider by default recently +-- which breaks `gq` and company paragraph formatting in non lsp +-- contexts. +vim.opt.formatexpr = "" vim.g.BASH_AuthorName = 'Jeremy Wall' vim.g.BASH_AuthorRef = 'jw' @@ -256,6 +260,10 @@ vim.api.nvim_create_autocmd('LspAttach', { if client and client.server_capabilities.codelens then vim.lsp.codelens.refresh() end + -- formatexpr defaulted to the lsp provider by default recently + -- which breaks `gq` and company paragraph formatting in non lsp + -- contexts. + vim.bo[args.buf].formatexpr = "" end, })