36 lines
852 B
Lua
36 lines
852 B
Lua
return {
|
|
{
|
|
'stevearc/conform.nvim',
|
|
event = { 'BufWritePre' },
|
|
cmd = { 'ConformInfo' },
|
|
keys = {
|
|
{
|
|
'<leader>fo',
|
|
function()
|
|
require('conform').format { async = true, lsp_fallback = true }
|
|
end,
|
|
mode = '',
|
|
desc = '[Fo]rmat Buffer',
|
|
},
|
|
},
|
|
opts = {
|
|
notify_on_error = false,
|
|
format_on_save = function(bufnr)
|
|
local disable_filetypes = { c = true, cpp = true, sh = true }
|
|
return {
|
|
timeout_ms = 500,
|
|
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
|
}
|
|
end,
|
|
formatters_by_ft = {
|
|
lua = { 'stylua' },
|
|
python = { 'pyright', 'isort', 'black' },
|
|
md = { 'prettier' },
|
|
nix = { 'nixfmt' },
|
|
yaml = { 'yamlfmt' },
|
|
sh = { 'shfmt' },
|
|
},
|
|
},
|
|
},
|
|
}
|