nvim/lua/config/format.lua
2025-03-04 20:03:28 +01:00

14 lines
564 B
Lua

require('nvim-format-buffer').setup({
verbose = false,
format_rules = {
{ pattern = { '*.c', '*.h' }, command = 'clang-format' },
{
pattern = { '*.js', '*.mjs', '*.ts', '*.mts', '*.cjs', '*.tsx', '*.vue', '*.css' },
command = function()
return 'prettier --stdin-filepath ' .. vim.api.nvim_buf_get_name(0)
end,
},
{ pattern = { "*.sql" }, command = "pg_format --spaces=2 --wrap-limit=1000 --no-rcfile" },
{ pattern = { "*.py", "*.pyi" }, command = "ruff check --select I --fix --silent - | ruff format -" }
},
})