vim.pack.add({ 'https://github.com/nvimdev/guard.nvim', 'https://github.com/nvimdev/guard-collection', }, { load = function() end }) return { 'nvimdev/guard.nvim', before = function() vim.cmd.packadd('guard-collection') vim.g.guard_config = { fmt_on_save = false, save_on_fmt = true, lsp_as_default_formatter = true, } end, keys = { { 'gF', 'Guard fmt', mode = { 'n', 'x' } }, }, after = function() local ft = require('guard.filetype') ft('python') :fmt({ cmd = 'isort', args = { '--profile', 'black', '-' }, stdin = true, }) :append('black') :lint('mypy') ft('lua'):fmt('stylua'):lint('selene') ft('javascript,javascriptreact,typescript,typescriptreact') :fmt('prettierd') :lint('eslint_d') ft('css,graphql,html,json,jsonc,mdx,yaml'):fmt('prettierd') ft('sh,bash,zsh'):fmt({ cmd = 'shfmt', args = { '-i', '2' }, stdin = true, }) ft('sh,bash'):lint('shellcheck') ft('zsh'):lint('zsh') ft('proto'):fmt('buf'):lint('buf') ft('dockerfile'):lint('hadolint') ft('tex'):fmt('latexindent') ft('typst'):fmt('typstyle') ft('cmake'):fmt('cmake-format') ft('make'):lint('checkmake') ft('cpp'):lint('cpplint') ft('markdown'):fmt('cbfmt'):append('prettierd') ft('nix'):fmt({ cmd = 'nix', args = { 'fmt', '--' }, fname = true, }) end, }