fix: gq with null-ls

This commit is contained in:
Noah Masur 2023-06-24 15:15:50 -06:00
parent a26f5dc2b5
commit b282e76be4

View File

@ -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,
})