From 4264fde0fa429c8136dda52ac936deecc9609dec Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 31 Jan 2025 17:38:25 +0000 Subject: [nvim][lsp] Change conform config --- home/.config/nvim/lua/custom/plugins/lsp.lua | 35 +++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'home') diff --git a/home/.config/nvim/lua/custom/plugins/lsp.lua b/home/.config/nvim/lua/custom/plugins/lsp.lua index 4447ff6..1dfd400 100644 --- a/home/.config/nvim/lua/custom/plugins/lsp.lua +++ b/home/.config/nvim/lua/custom/plugins/lsp.lua @@ -208,23 +208,26 @@ return { desc = "Format buffer", }, }, - opts = { - formatters_by_ft = { - python = { "ruff_format" }, - cmake = { "cmake_format" }, - json = { "jq" }, - rust = { "rustfmt" }, - sh = { "shfmt" }, - bash = { "shfmt" }, - zsh = { "shfmt" }, - }, - formatters = { - shfmt = { - prepend_args = { "-i", "2" }, + config = function() + require("conform").setup({ + formatters_by_ft = { + python = { "ruff_format" }, + cmake = { "cmake_format" }, + json = { "jq" }, + rust = { "rustfmt" }, + sh = { "shfmt" }, + bash = { "shfmt" }, + zsh = { "shfmt" }, }, - }, - }, - init = function() + default_format_opts = { + lsp_format = "fallback", + }, + formatters = { + shfmt = { + prepend_args = { "-i", "2" }, + }, + }, + }) vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" vim.api.nvim_create_autocmd("BufWritePre", { callback = require "cfg.utils".format_hunks, -- cgit v1.2.3-70-g09d2