Closed nnathan closed 3 days ago
You are calling conform.setup()
three times. Each time you call it, we will clear any autocmds created previously (and if configured, create new ones). What is likely happening is you're doing this:
require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
-- Conform will run multiple formatters sequentially
python = { "isort", "black" },
-- You can customize some of the format options for the filetype (:help conform.format)
rust = { "rustfmt", lsp_format = "fallback" },
-- Conform will run the first available formatter
javascript = { "prettierd", "prettier", stop_after_first = true },
-- Conform for gopls
go = { "gofumpt" },
},
})
Autocmds were cleared, none created. No-op.
require("conform").setup({
format_on_save = {
-- These options will be passed to conform.format()
-- timeout for 10s for mac where first exec of binary
-- takes awhile
timeout_ms = 10000,
lsp_format = "fallback",
},
})
Autocmds created now
config = function()
require("conform").setup()
end,
Autocmds cleared again
I would recommend only calling setup()
once with all of your config options.
Neovim version (nvim -v)
v0.10.0
Operating system/version
MacOS 15.1
Read debugging tips
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
N/A
Describe the bug
Conform format_on_save isn't working with my neovim kickstart setup. If I modify the conform
init.lua
such that I comment out thegroup = aug
in theBufWritePre
autocommand, it is working fine.My nvim
init.lua
works fine on Ubuntu 22.04/WSL2, in that Conform does the right thing. It just doesn't work on my mac.Manually creating the autocmd as an alternative to format_on_save as described in the README works, and it's the workaround I'm using.
I couldn't reproduce this issue with
repro.lua
. I'm hoping to get some assistance.What is the severity of this bug?
tolerable (can work around it)
Steps To Reproduce
I've provided my
init.lua
in Minimal init.lua.Expected Behavior
Using the format_on_save should
Minimal example file
foo.go
:Minimal init.lua
Additional context
No response