Damjan 9000 77d74fac16 Add type hints to plugins that were extracted from init.lua
Based on:

    commit 177ff6148391742ccb7aaa93c05b95cd6fc853e2
    Author:     orip <oriori1703@gmail.com>
    AuthorDate: Sat Apr 26 14:35:04 2025 +0300

    Add type hints to plugin options where possible

    This could help beginners to get autocompletion, catch mistakes earlier,
    and allow them to skip the docs for simple configs.

    This is not perfect because a lot of the plugins type all of their keys
    as required, even though they have defaults, but this is good enough.
2026-03-15 20:24:45 +01:00

46 lines
1.3 KiB
Lua

---@module 'lazy'
---@type LazySpec
return {
{ -- Autoformat
'stevearc/conform.nvim',
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
mode = '',
desc = '[F]ormat buffer',
},
},
---@module 'conform'
---@type conform.setupOpts
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
if disable_filetypes[vim.bo[bufnr].filetype] then
return nil
else
return {
timeout_ms = 500,
lsp_format = 'fallback',
}
end
end,
formatters_by_ft = {
lua = { 'stylua' },
-- 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