mirror of
https://github.com/dam9000/kickstart-modular.nvim.git
synced 2026-05-14 08:23:48 +00:00
48 lines
1.4 KiB
Lua
48 lines
1.4 KiB
Lua
---@module 'lazy'
|
|
---@type LazySpec
|
|
return {
|
|
{ -- Autoformat
|
|
'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)
|
|
-- You can specify filetypes to autoformat on save here:
|
|
local enabled_filetypes = {
|
|
-- lua = true,
|
|
-- python = true,
|
|
}
|
|
if enabled_filetypes[vim.bo[bufnr].filetype] then
|
|
return { timeout_ms = 500 }
|
|
else
|
|
return nil
|
|
end
|
|
end,
|
|
default_format_opts = {
|
|
lsp_format = 'fallback', -- Use external formatters if configured below, otherwise use LSP formatting. Set to `false` to disable LSP formatting entirely.
|
|
},
|
|
-- You can also specify external formatters in here.
|
|
formatters_by_ft = {
|
|
-- rust = { 'rustfmt' },
|
|
-- Conform can also run multiple formatters sequentially
|
|
-- python = { "isort", "black" },
|
|
--
|
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
|
},
|
|
},
|
|
},
|
|
}
|
|
-- vim: ts=2 sts=2 sw=2 et
|