diff --git a/nvim/lua/autocmds.lua b/nvim/lua/autocmds.lua deleted file mode 100644 index 8545628..0000000 --- a/nvim/lua/autocmds.lua +++ /dev/null @@ -1,31 +0,0 @@ -local autocmd = vim.api.nvim_create_autocmd - -autocmd('LspAttach', { - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - if client.supports_method('textDocument/formatting') then - -- Format the current buffer on save - vim.api.nvim_create_autocmd('BufWritePre', { - buffer = args.buf, - callback = function() - vim.lsp.buf.format({bufnr = args.buf, id = client.id}) - end, - }) - end - end, -}) - -autocmd('LspDetach', { - callback = function(args) - -- Get the detaching client - local client = vim.lsp.get_client_by_id(args.data.client_id) - -- Remove the autocommand to format the buffer on save, if it exists - if client.supports_method('textDocument/formatting') then - vim.api.nvim_clear_autocmds({ - event = 'BufWritePre', - buffer = args.buf, - }) - end - end, -}) - diff --git a/nvim/lua/configs/conform.lua b/nvim/lua/configs/conform.lua index 9371ea0..1659336 100644 --- a/nvim/lua/configs/conform.lua +++ b/nvim/lua/configs/conform.lua @@ -3,14 +3,22 @@ local options = { lua = { "stylua" }, css = { "prettier" }, html = { "prettier" }, - python = { "ruff", "pyright" } + python = { "ruff_format" }, + go = { "goimports", "gofmt" }, + json = { "jq" }, }, format_on_save = { -- These options will be passed to conform.format() timeout_ms = 500, - lsp_fallback = true, + lsp_format = "fallback", }, + -- Set the log level. Use `:ConformInfo` to see the location of the log file. + log_level = vim.log.levels.ERROR, + -- Conform will notify you when a formatter errors + notify_on_error = true, + -- Conform will notify you when no formatters are available for the buffer + notify_no_formatters = true, } return options