mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2025-10-21 20:10:41 +00:00
74 lines
1.7 KiB
Lua
74 lines
1.7 KiB
Lua
local js = { "biome", "biome-check" }
|
|
local html = { "djlint", "rustywind" }
|
|
local makrdown = { "cbfmt", "markdownlint", "markdown-toc" }
|
|
|
|
return {
|
|
"stevearc/conform.nvim",
|
|
event = { "BufWritePre" },
|
|
cmd = { "ConformInfo" },
|
|
keys = {
|
|
{
|
|
"<leader>f",
|
|
function()
|
|
require("conform").format({ async = true, lsp_fallback = "fallback" })
|
|
end,
|
|
mode = "",
|
|
desc = "Format buffer",
|
|
},
|
|
},
|
|
opts = {
|
|
formatters_by_ft = {
|
|
["_"] = { "trim_whitespace" },
|
|
["*"] = { "injected" },
|
|
asm = { "asmfmt" },
|
|
bash = { "shfmt" },
|
|
c = { "clang-format" },
|
|
cmake = { "cmake_format" },
|
|
cpp = { "clang-format" },
|
|
css = { "prettier" },
|
|
go = { "goimports", "gofmt" },
|
|
html = html,
|
|
htmldjango = html,
|
|
http = { "kulala-fmt" },
|
|
javascript = js,
|
|
javascriptreact = js,
|
|
json = { "jq" },
|
|
lua = function()
|
|
local config_file = vim.fn.getcwd() .. "/*stylua.toml"
|
|
if vim.fn.exists(config_file) then
|
|
return { "stylua" }
|
|
end
|
|
return {}
|
|
end,
|
|
markdown = makrdown,
|
|
python = { "ruff_format", "ruff_fix", "ruff_organize_imports", "docformatter" },
|
|
rest = { "kulala" },
|
|
rust = { "rustfmt", "leptosfmt", "yew-fmt" },
|
|
scss = { "prettier" },
|
|
sql = { "sqruff" },
|
|
toml = { "taplo" },
|
|
typescript = js,
|
|
typescriptreact = js,
|
|
typst = { "typstyle" },
|
|
vimwiki = makrdown,
|
|
yaml = { "yamlfmt" },
|
|
},
|
|
formatters = {
|
|
sqruff = {
|
|
prepend_args = function(_self, _ctx)
|
|
return {
|
|
"--config",
|
|
vim.fn.expand("~/.config/sqruff/config.cfg"),
|
|
}
|
|
end,
|
|
},
|
|
},
|
|
format_on_save = {
|
|
timeout_ms = 500,
|
|
lsp_format = "fallback",
|
|
},
|
|
log_level = vim.log.levels.ERROR,
|
|
notify_on_error = true,
|
|
},
|
|
}
|