Files
neovim/lua/plugins/conform.lua
2025-11-04 12:12:00 +01:00

44 lines
1.1 KiB
Lua

return {
"stevearc/conform.nvim",
opts = {},
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
css = { "prettier" },
elm = { "elm_format" },
graphql = { "prettier" },
json = { "prettier" },
html = { "prettier" },
liquid = { "prettier" },
lua = { "stylua" },
markdown = { "prettier" },
python = { "ruff_fix", "ruff_format" },
rust = { "rustfmt" },
svelte = { "prettier" },
javascript = { "prettier" },
javascriptreact = { "prettier" },
typescript = { "prettier" },
typescriptreact = { "prettier" },
yaml = { "prettier" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
},
})
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({
lsp_format = "fallback",
async = false,
timeout_ms = 1000,
})
end, { desc = "Format file or range (in visual mode)" })
end,
}