56 lines
1.4 KiB
Lua
56 lines
1.4 KiB
Lua
return {
|
|
{
|
|
"stevearc/conform.nvim",
|
|
event = { "BufWritePre" },
|
|
cmd = "ConformInfo",
|
|
keys = {
|
|
{
|
|
"<leader>cF",
|
|
function()
|
|
require("conform").format({ formatters = { "injected" } })
|
|
end,
|
|
mode = { "n", "v" },
|
|
desc = "Format Injected Langs",
|
|
},
|
|
},
|
|
config = function()
|
|
require("conform").setup({
|
|
format_on_save = {
|
|
-- These options will be passed to conform.format()
|
|
timeout_ms = 500,
|
|
lsp_fallback = true,
|
|
},
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
python = { "isort", "autopep8" },
|
|
haskell = { "fourmolu" },
|
|
bash = { "shellcheck", "shellharden" },
|
|
sh = { "shfmt" },
|
|
markdown = { "prettierd" },
|
|
json = { "prettierd" },
|
|
yaml = { "prettierd" },
|
|
nix = { "nixfmt" },
|
|
tex = { "latexindent" },
|
|
["*"] = { "codespell" },
|
|
["_"] = { "trim_whitespace" },
|
|
},
|
|
formatters = {
|
|
stylua = {
|
|
inherit = true,
|
|
prepend_args = { "--indent-type", "Spaces", "--indent-width", "2" },
|
|
},
|
|
codespell = {
|
|
inherit = true,
|
|
prepend_args = { "-L", "launch" },
|
|
},
|
|
latexindent = {
|
|
inherit = true,
|
|
prepend_args = { "-y=\"defaultIndent:' '\"" },
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
}
|
|
|