54 lines
1.3 KiB
Lua
54 lines
1.3 KiB
Lua
local options = {
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
c_cpp = { "clang-format" },
|
|
c = { "clang_format" },
|
|
cpp = { "clang_format" },
|
|
go = { "gofumpt", "goimports-reviser", "golines" },
|
|
python = { "isort", "black" },
|
|
bash = { "shfmt" },
|
|
rust = { "rustfmt" },
|
|
},
|
|
|
|
-- Format files style
|
|
formatters = {
|
|
clang_format = {
|
|
prepend_args = {
|
|
"-style={ \
|
|
IndentWidth: 4, \
|
|
TabWidth: 4, \
|
|
UseTab: Never, \
|
|
AccessModifierOffset: 0, \
|
|
IndentAccessModifiers: true, \
|
|
PackConstructorInitializers: Never}",
|
|
},
|
|
},
|
|
["goimports-reviser"] = {
|
|
prepend_args = { "-rm-unused" },
|
|
},
|
|
golines = {
|
|
prepend_args = { "--max-len=80" },
|
|
},
|
|
black = {
|
|
prepend_args = {
|
|
"--fast",
|
|
"--line-length",
|
|
"80",
|
|
},
|
|
},
|
|
isort = {
|
|
prepend_args = {
|
|
"--profile",
|
|
"black",
|
|
},
|
|
},
|
|
},
|
|
|
|
format_on_save = {
|
|
timeout_ms = 500,
|
|
lsp_fallback = true,
|
|
},
|
|
}
|
|
|
|
require("conform").setup(options)
|