refactor + fmt
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
---@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" },
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user