2023-09-30 16:44:22 +02:00
|
|
|
return {
|
|
|
|
"stevearc/conform.nvim",
|
2024-04-03 17:08:26 +02:00
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
2023-09-30 16:44:22 +02:00
|
|
|
config = function()
|
|
|
|
local conform = require("conform")
|
|
|
|
|
|
|
|
conform.setup({
|
|
|
|
formatters_by_ft = {
|
|
|
|
javascript = { "prettier" },
|
|
|
|
typescript = { "prettier" },
|
|
|
|
javascriptreact = { "prettier" },
|
|
|
|
typescriptreact = { "prettier" },
|
|
|
|
svelte = { "prettier" },
|
|
|
|
css = { "prettier" },
|
|
|
|
html = { "prettier" },
|
|
|
|
json = { "prettier" },
|
|
|
|
yaml = { "prettier" },
|
|
|
|
markdown = { "prettier" },
|
|
|
|
graphql = { "prettier" },
|
2024-04-03 17:08:26 +02:00
|
|
|
liquid = { "prettier" },
|
2023-09-30 16:44:22 +02:00
|
|
|
lua = { "stylua" },
|
|
|
|
python = { "isort", "black" },
|
|
|
|
},
|
|
|
|
format_on_save = {
|
|
|
|
lsp_fallback = true,
|
|
|
|
async = false,
|
|
|
|
timeout_ms = 1000,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
|
|
|
|
conform.format({
|
|
|
|
lsp_fallback = true,
|
|
|
|
async = false,
|
|
|
|
timeout_ms = 1000,
|
|
|
|
})
|
|
|
|
end, { desc = "Format file or range (in visual mode)" })
|
|
|
|
end,
|
|
|
|
}
|