return { 'conform.nvim', event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, keys = { { 'cf', function() require('conform').format() end, desc = 'format', }, { 'cF', function() require('conform').format({ formatters = { 'injected' }, timeout_ms = 3000, }) end, mode = { 'n', 'v' }, desc = 'format injected langs', }, }, after = function() require('conform').setup({ format_on_save = function(buf) if (vim.g.autoformat == false) or (vim.b[buf].autoformat == false) then return end return { timeout_ms = 3000, lsp_format = 'fallback' } end, formatters_by_ft = { lua = { 'stylua' }, fish = { 'fish_indent' }, sh = { 'shfmt' }, }, }) vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" end, }