37 lines
1 KiB
Lua
37 lines
1 KiB
Lua
return {
|
|
"mhartington/formatter.nvim",
|
|
|
|
cmd = {
|
|
"Format",
|
|
"FormatLock",
|
|
"FormatWrite",
|
|
"FormatWriteLock",
|
|
},
|
|
|
|
keys = {
|
|
-- stylua: ignore start
|
|
{ "<leader>F", "<cmd>Format<cr>", desc = " Format file" },
|
|
{ "<leader>F", "<cmd>'<,'>Format<cr>", mode = "v", desc = " Format selection" },
|
|
-- stylua: ignore end
|
|
},
|
|
|
|
opts = function(_, opts)
|
|
local builtin = require("formatter.filetypes")
|
|
return vim.tbl_deep_extend("force", opts or {}, {
|
|
filetype = {
|
|
-- stylua: ignore start
|
|
c = { builtin.c.clangformat },
|
|
cmake = { builtin.cmake.cmakeformat },
|
|
cpp = { builtin.cpp.clangformat },
|
|
cs = { builtin.cs.clangformat },
|
|
json = { builtin.cs.prettier },
|
|
lua = { builtin.lua.stylua },
|
|
markdown = { builtin.markdown.prettier },
|
|
python = {}, -- TODO: pick one
|
|
sh = { builtin.sh.shfmt },
|
|
zsh = { builtin.zsh.beautysh },
|
|
-- stylua: ignore end
|
|
},
|
|
})
|
|
end,
|
|
}
|