Files
dotfiles/vim/.vim/lua/plugins/conform.lua
Christian Nieves 5995aeaf32 meh
2024-01-06 07:49:08 -06:00

48 lines
1.2 KiB
Lua

return {
{
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>fmt",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
desc = "Format buffer",
},
},
opts = {
formatters_by_ft = {
-- Conform will run multiple formatters sequentially
-- go = { "goimports", "gofmt" },
-- Use a sub-list to run only the first available formatter
-- javascript = { { "prettierd", "prettier" } },
lua = { "stylua" },
-- Conform will run multiple formatters sequentially
python = { "isort", "black" },
-- Use a sub-list to run only the first available formatter
javascript = { { "prettierd", "prettier" } },
gdscript = { "gdformat" },
dashboard = {},
-- Use the "*" filetype to run formatters on all filetypes.
["*"] = { "codespell" },
-- Use the "_" filetype to run formatters on filetypes that don't
-- have other formatters configured.
["_"] = { "trim_whitespace" },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
formatters = {
gdformat = {
prepend_args = { "-l", "100" },
},
},
},
},
}