36 lines
800 B
Lua
36 lines
800 B
Lua
---@module 'lazy'
|
|
---@type LazySpec
|
|
return {
|
|
'stevearc/conform.nvim',
|
|
event = { 'BufWritePre' },
|
|
cmd = { 'ConformInfo' },
|
|
keys = {
|
|
{
|
|
'<leader>f',
|
|
function() require('conform').format { async = true } end,
|
|
mode = '',
|
|
desc = '[F]ormat buffer',
|
|
},
|
|
},
|
|
---@module 'conform'
|
|
---@type conform.setupOpts
|
|
opts = {
|
|
notify_on_error = false,
|
|
format_on_save = function(bufnr)
|
|
local enabled_filetypes = {
|
|
-- lua = true,
|
|
-- python = true,
|
|
}
|
|
if enabled_filetypes[vim.bo[bufnr].filetype] then return { timeout_ms = 500 } end
|
|
return nil
|
|
end,
|
|
default_format_opts = {
|
|
lsp_format = 'fallback',
|
|
},
|
|
formatters_by_ft = {
|
|
-- rust = { 'rustfmt' },
|
|
-- python = { "isort", "black" },
|
|
},
|
|
},
|
|
}
|